Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: drop observations after first occurence of an event


From   raoul reulen <[email protected]>
To   [email protected]
Subject   st: drop observations after first occurence of an event
Date   Fri, 19 Feb 2010 13:16:34 +0000

Dear All

Apologies for the probably straightforward query, but I cannot get it
done. I want to drop any observations after the first occurrence of an
event (coded as 1)  in my dataset. I am not interested in what happens
after the event, so want to drop any subsequent observations whether
they are events or not. See example below. For id nr 1 I want to drop
all observation after the first occurence of the number "1".

id event
1 0
1 0
1 0
1 1
1 0  <--drop
1 0 <--drop
2 0
2 0
2 1
2 1 <--drop
2 0 <--drop
3 0
3 1
3 0 <--drop
3 1 <--drop

Many thanks.

Raoul
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index