Wednesday, March 01, 2006
st: Re: assigning household characteristics to an individual with missing values
I have the following:
Household ID Relationship Remits 1 father 1 1 mother 1 1 son 1 2 father . 2 mother . 2 son . 3 father 0 3 mother 0 3 daughter 1
I would like to create a Remit_hh varible that tells me if the head of household (we can assume it is always father for this simple example) receives remittances. Remits takes on the value of 1 when the person receives and zero if they do not receive.
I tried the following:
generate remits_hh=remits if relationship==father by hhid: replace remits_hh=sum(remits_hh)
It creates a problem where there are missing values, it places a 0. I guess I can then say:
replace remits_hh=remits if remits==.
but is there a better way to get at this than having to do the third command to all my variables that have missing values.
* * 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/
Links to this post: