This sounds like
bysort id time : gen jobs = _n
Advice about -by:- is given at
several points in the manual, or
in one tutorial at
How to move step by: step.
Stata Journal 2(1): 86-102 (2002)
Nick
[email protected]
daphna
> I have observations about people at 24 time points and
> oftentimes I have
> more than 1 observation per time period. The data is about
> earnings, so
> for instance, if a person had two jobs in june 1996, i have two
> observations for them then. If they had 3 jobs in october
> 1996, I would
> have 3 observations for that time period- one observation per job.
>
> For now, all I would like to do it create a new variable
> "jobs" which
> arbitrarily assigns a number to each job within a time
> period. (ie. 1 for
> the first job in 6/96, 2 for the second, 1 for the first job
> in 10/96... etc)
>
> (eventually i will use this variable to reshape the data)
>
> I hope my question makes sense. I can't seem to find a
> command that will do this, but I may have just missed it.
*
* 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/