Hi,
I have a dataset with an id variable, and a time variable with
distinct values for each observation, like this:
id t
1 1999m12
1 2000m1
1 2000m2
2 2004m7
2 2004m8
3 2001m2
...
I would like to create a new variable, t2, with the next corresponding
time value for each id. The result would look like this:
id t t2
1 1999m12 2000m1
1 2000m1 2000m2
1 2000m2 .
2 2004m7 2004m8
2 2004m8 .
3 2001m2 .
...
I tried "gen t2=f.t" after "xtset id t", but it only returned empty
values. Is there any way to do this for a large dataset?
Thanks
Carlos del Carpio
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/