Statalist


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

Re: st: RE: Data management in Stata 9.0


From   n j cox <n.j.cox@durham.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Data management in Stata 9.0
Date   Tue, 06 May 2008 18:45:16 +0100

Note also that using the -label- option with -egen, group()- gives you the original information in label form.

Ramaele is using Stata 9.0. Ramaele should -update- that to 9.2, or get the local systems administrator to do that. It is free.

Nick
n.j.cox@durham.ac.uk

Eva Poen

2008/5/6 Maarten buis <maartenbuis@yahoo.co.uk>:
> --- 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.


*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index