Wednesday, March 01, 2006
Re: st: Re: assigning household characteristics to an individual with missing values
If you have a numeric relationship code which is small (e.g. one) for the household head, you could: . bys hhid (relationship): gen remit_hh=remit but you should answer Friedrich Huebler's question to your own satisfaction before you proceed.
To do literally what you requested, you might . gen notdad=relationship!=father . bys hhid (notdad): gen remit_hh=remit assuming there is exactly one father per hhid.
There are equivalent methods using egen, e.g. . generate fremits=remits if relationship==father . egen remits_hh=max(fremits), by(hhid) but these are less adaptable methods (IMHO)-- it's probably good to learn -bysort- sooner rather than later.
On 3/1/06, Friedrich Huebler <firstname.lastname@example.org> wrote: > Marilyn, > > Out of curiosity, what kind of data has households in which everyone > is either a father, mother, son, or daughter? What if there is no > father or more than one father in a household? Wouldn't it be more > precise if you had a variable that actually identifies the household > head, which may be simply the person listed first in each household? > > Friedrich Huebler
* * 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: