Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: assigning household characteristics to an individual with missing values


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Re: assigning household characteristics to an individual with missing values
Date   Wed, 1 Mar 2006 14:48:44 -0500

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 <[email protected]> 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/



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