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[1] 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[1] 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 <huebler@rocketmail.com> 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?