Statalist


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

Re: st: coding households in survey data


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: coding households in survey data
Date   Mon, 21 Apr 2008 10:42:12 -0400

Gisella Young <[email protected]>:
This is part of a FAQ.

g long hhid=sum(person==1)

should do it.  See also
http://www.stata.com/support/faqs/data/members.html
http://www.stata-journal.com/sjpdf.html?articlenum=pr0004


On Mon, Apr 21, 2008 at 7:21 AM, Gisella Young <[email protected]> wrote:
> Dear Statalisters,
>
> I have a simple question. I am working with a household dataset in which the households are not coded as such but are evident from the individual numbers. It is set up as follows:
>
> PERSON    VAR1    VAR2 ...
> 1
> 2
> 3
> 1
> 1
> 2
> ....
>
> (I haven't filled in the variables above).
>
> The 'person' data actually refers to the person's household membership ie household one has 3 members, houshold 2 has 1 member, household 3 has 2
> members, etc. I would like to create a new variable 'household', in which each household has a unique number as follows:
>
> HOUSEHOLD    PERSON    VAR1    VAR2 ...
> 1              1
> 1              2
> 1              3
> 2              1
> 3              1
> 3              2
> ....
>
> (Then if I concatenate 'household' and 'person' each individual will have a uniqe number.)
>
> Any suggestions as to how to create the household variable?
>
> Thank you!
>
> Gisella
*
*   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