bysort regno (lboyear exityear) : keep if _n == 1 | _n == _N
Nick
[email protected]
Kevin Amess
> I've got mysefl stuck on this little problem. My data is in
> the following form:
>
> regno lboyear exityear X....
> 1 1992 2003
> 1 2000 .
> 1 1992 1996
> 1 1996 2000
> 2 2000 2003
> 2 1993 2000
> 3 1997 .
> 3 1993 1997
> 4 2000 .
> 5 1999 2002
>
> I would like to:
> 1. Keep the earliest lboyear and the X variables associated
> with this earliest lboyear
> 2. Keep the latest exit year. Note that . indicates no exit,
> so I would want to keep the dot and not the latest year. I
> think this is handy as Stata stores it as +infinity.
*
* 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/