|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: multiple observations
Replying on how to tag the last observation for each case,
On 8 Sep 2008, at 13:14, fjc fjc wrote:
You can also try:
gen newid = .
bysort id: replace newid = 1 if _n == _N
The problem is to make sure that the last observation for each id is
really the last observation.
To be doubly sure, you need a variable that identifies the
observation, then make sure that it too is sorted
bysort id (obsnumber) : replace newid=1 if _n == _N
Ronan Conroy
=================================
[email protected]
Royal College of Surgeons in Ireland
Epidemiology Department,
Beaux Lane House, Dublin 2, Ireland
+353 (0)1 402 2431
+353 (0)87 799 97 95
+353 (0)1 402 2764 (Fax - remember them?)
http://www.flickr.com/photos/ronanconroy/sets/72157601895416740/
P Before printing, think about the environment
*
* 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/