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

st: st Filling in values


From   Stephen McKay <[email protected]>
To   [email protected]
Subject   st: st Filling in values
Date   Tue, 21 Oct 2003 11:16:32 +0100

Eva asked about 

> 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      
> 
> Thanks a lot,
> Eva      

and Nick Cox and Stephen Jenkins suggested variants of:

> bysort family (children) : replace children = children[_N] 

I would only add that if other information is collected at "head of 
household" level (as is common) you might want to save that information 
into a separate file, and use -merge- commands to 'fill in' values at 
the person level. But go with the 'bysort' approach if it's just a few 
variables you want to do this for.

Steve McKay
*
*   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