Statalist


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

Re: st: RE: Data management in Stata 9.0


From   "Eva Poen" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Data management in Stata 9.0
Date   Tue, 6 May 2008 18:01:34 +0100

2008/5/6 Maarten buis <[email protected]>:
> --- Ramaele Moshoeshoe wrote me privately:
>  > [...]
>  > My problem is now to give each household a unique I.D. for the entire
>  > data set such that for all households and/or individuals sharing the
>  > same number fall under one Household, taking into accout the Zone and
>  > Region.

>  [...]
>  gen long id = hhno + 10*zone + 100*district + 1000*region

What is nice about Maarten's solution is that, from just looking at
the household id, you can tell zone, district and region of an
observation.

Should you worry about your household ids becoming too long with this
this system, you can also do the following:

egen hhid = group(region district zone hhno)

This will consecutively number your households, starting at 1.

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