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

st: RE: RE: Identifying the nearest observation in a household survey


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Identifying the nearest observation in a household survey
Date   Thu, 21 Apr 2005 13:58:06 +0100

I'd add a condition that 

serial == serial[_n+1] 

Nick 
[email protected] 

Scott Merryman replied to Deborah Garvey
 
> <snip>
> > I
> > want the adult who is listed before the child in the 
> household record,
> > since Census/sociology research shows he/she is most likely 
> to be the
> > parent.
> > 
> > An example:
> > 
> > serial     pernum     nfams     famunit famsize   related   
>            age
> > sex  marital
> > 2411276          1         6           1            1   
> Head/Householder
> > 88   F  widow
> > 2411276          2         6           2            1   Other non-
> > relatives 49   M single
> > 2411276          2         6           3            2   Other non-
> > relatives 49   M married
> > 2411276          3         6           3            2   Other non-
> > relatives  42  F  married
> > 2411276          4         6           4            1   Other non-
> > relatives    6  F  single
> > 2411276          5         6           5            1   Other non-
> > relatives  68  F widow
> > 2411276          6         6           6            1   Other non-
> > relatives  58  M widow
> > 
> > The child in line #4 is most likely the child of #2 and #3. 
>  Can someone
> > help me get started?  I'm running Stata/SE 8.2, Windows, 
> born 1/10/05.
> > 
> 
> Do you mean something like this?
> 
> . l serial relate age sex marital , abb(32) noobs
> 
>   +--------------------------------------------------+
>   |  serial            related   age   sex   marital |
>   |--------------------------------------------------|
>   | 2411276   Head/Householder    88     F     widow |
>   | 2411276              Other    49     M    single |
>   | 2411276              Other    49     M   married |
>   | 2411276              Other    42     F   married |
>   | 2411276              Other     6     F    single |
>   |--------------------------------------------------|
>   | 2411276              Other    68     F     widow |
>   | 2411276              Other    58     M     widow |
>   +--------------------------------------------------+
> 
> . mark child if age <18
> 
> . mark parent_of_child if age>=18 & child[_n+1] == 1
> 
> . l serial  age sex marital child par, abb(32) noobs
> 
>   +---------------------------------------------------------+
>   |  serial   age   sex   marital   child   parent_of_child |
>   |---------------------------------------------------------|
>   | 2411276    88     F     widow       0                 0 |
>   | 2411276    49     M    single       0                 0 |
>   | 2411276    49     M   married       0                 0 |
>   | 2411276    42     F   married       0                 1 |
>   | 2411276     6     F    single       1                 0 |
>   |---------------------------------------------------------|
>   | 2411276    68     F     widow       0                 0 |
>   | 2411276    58     M     widow       0                 0 |
>   +---------------------------------------------------------+

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