In addition to possibilities (and possible problems)
flagged by others, I note the -egen, seq()- function.
egen id = seq(), block(3)
egen time = seq(), to(3)
Nick
[email protected]
Dongshu Ou
> > > data set looks like
> > >
> > > var1 var2 var3
> > >
> > > 80 30 1
> > > 75 30 1
> > > 85 30 1
> > > 76 33 1
> > > 78 33 1
> > > 75 33 1
> > > 80 29 2
> > > 82 29 2
> > > 83 29 2
> > > ...................
> > >
> > > Say, var1 is an indicator measured at 3 different times of each
> > > individual. var2 is age, var3 indicates "group"
> > >
> > > I want to generate a variable to indicate every three of the var1
> > > belongs to the same person, and a variable indicating three
> > > different times for the same person , which would be looked like:
> > >
> > > var1 var2 var3 Var4 Var5
> > >
> > > 80 30 1 1 1
> > > 75 30 1 1 2
> > > 85 30 1 1 3
> > > 76 33 1 2 1
> > > 78 33 1 2 2
> > > 75 33 1 2 3
> > > 80 29 2 3 1
> > > 82 29 2 3 2
> > > 83 29 2 3 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/