Michael Blasnik and Svend Juul both rightly pointed
to -egen, group()-.
Yibing Wang and other newish or inexperienced Stata users
should also note that
. search identifier
points to various material, including
FAQ . . . . . . . . . . . . . . . . . . . . . . Creating group identifiers
3/01 How do I create individual identifiers numbered
from 1 upwards?
http://www.stata.com/support/faqs/data/group.html
Nick
[email protected]
Yibing (Eric) Wang
> > I'm relatively new to Stata, I have a dataset as
> > follows:
> >
> > hhid psid year
> > 1 1 1989
> > 1 1 1991
> > 1 1 1993
> > 1 1 2000
> > 1 2 1989
> > 1 2 1991
> > 1 2 1993
> > 1 2 2000
> > 2 1 1989
> > 2 1 1991
> > 2 1 1993
> > 2 1 2000
> > ... ... ...
> > hhid=household ID
> > psid=personal ID within a household
> > And my question is how to create a personal ID (say
> > uid) applied to the whold panel dataset that looks
> > like:
> > hhid psid year uid
> > 1 1 1989 1
> > 1 1 1991 1
> > 1 1 1993 1
> > 1 1 2000 1
> > 1 2 1989 2
> > 1 2 1991 2
> > 1 2 1993 2
> > 1 2 2000 2
> > 2 1 1989 3
> > 2 1 1991 3
> > 2 1 1993 3
> > 2 1 2000 3
> > ... ... ... ....
> >
*
* 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/