Dear statalist,
because I have only timeinvariant covariats I would like to reduce my
panel data set (structure see below) to an cross sectional data set.
The structure of my panel data set:
Id year Status Survivaltime x1 x2
1 2000 0 1003
1 2001 0 1003
1 2002 1 1003
2 2003 0 298
2 2004 2 298
3 1998 0 3989
3 1999 0 3989
3 2000 0 3989
3 2001 0 3989
3 2002 0 3989
3 2003 0 3989
3 2004 0 3989
3 2005 0 3989
Desired structure of data set:
Id year Status Survivaltime x1 x2
1 2002 1 1003
2 2004 2 298
3 2005 0 3989
I would like to keep only the last observation (which give me the outcome
of survival or death). My problem is now, that the outcome does not occure
always in the same year (as you can see it can happen in 2002 or 2005 or
whenever between 1998 and 2008). The other problem I face is, that I can
not use the command drop if status==0 because 0 can be also the desired
outcome in the last year.
Does anybody know how I could keep the last observation and drop all other
observation?
Thank you so much for your help.
Best regards
Frauke
___________________________________
Frauke Rüther, Dipl.-Kffr., M.A.
Research Associate
University of St.Gallen
Institute of Technology Management
Dufourstrasse 40a
CH - 9000 St. Gallen
Phone +41 (0)71 224 7225
Fax +41 (0)71 224 7301
Email [email protected]
Web www.item.unisg.ch
*
* 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/