See if this helps:
http://www.stata.com/support/faqs/data/members.html
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Hans J.
> Baumgartner
> Sent: 24 March 2004 16:09
> To: statalist
> Subject: st: [Fwd: gen a between houshold id]
>
>
> Dear Statalist,
>
> Can anybody help me to generate a new variable that indicates the
> household of the parents. To clarify my data:
>
> persnr sex V05001 vnr v_hh
> 1 m 1 . .
> 2 f 1 . .
> 3 f 1 1 1
> 4 f 11 1 1
>
> persnr is a person identifier (1 = the father, 2 = the
> mother, 3 = the
> daughter that lives with the parents and 4 = the daughter
> that lives in
> another household).
> vnr identifies the persnr of the father.
>
> I would like to generate a new variable v_hh that identifies the
> houshold id (V05001) of the father. It is easy for the daughter that
> lives with her parents but I find it quite difficult to generate the
> between household link with the daughter that does not live with her
> parents.
>
> I thus constructed a loop that is copy/pasted below. However,
> I do have
> 21,000 obs. and I do have to run the loop twice, i.e. for
> both parents,
> which takes more than 3 hours.
>
> Can anybody help me to generat faster between household links?
>
> And to make thinks even more complicated. I have more than two
> generations in my data, that is, motherid and fatherid does not
> necessarily be missing.
>
> I appreciate all comments.
*
* 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/