Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: numbering observations


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: numbering observations
Date   Wed, 21 Sep 2005 15:51:08 -0400

bysort person date: gen jobs=_n

Michael Blasnik
[email protected]

----- Original Message ----- From: "daphna" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 21, 2005 3:45 PM
Subject: st: numbering observations



I have a very basic question, so I am sorry to bother the list members if this is too obvious.

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.

Thanks for any advice,

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