Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: filling in values


From   "Stephen P. Jenkins" <[email protected]>
To   [email protected]
Subject   Re: st: filling in values
Date   Mon, 20 Oct 2003 12:42:55 +0100 (GMT Daylight Time)

On Mon, 20 Oct 2003 12:24:12 +0100 (BST) [email protected] wrote:

> Dear Statalist,
> 
> in the survey I am using the head of household gives info about every member
> of  the household. I have created a variable via egen that accounts for the
> number of children within the family. How do "fill in" for the rest of the
> family, i.e. family 3 has 1 child and I want observation 5 and 6 to be equal
> to 1, for example.
> 
>                family     children        
>        1.         1          0          
>        
>        2.         2          0          
>        3.         2          0           
>        4.         2          0           
>        
>        5.         3          1          
>        6.         3          0           
> 
>        7.         4          0           
>        8.         4          2      
> 

how about 

	bysort family: egen numkids = max(children)

combined with appropriate checking of what happens in cases where there 
are missing values on relevant variables

Stephen
----------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
http://www.iser.essex.ac.uk

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index