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: AW: drop observations after first occurence of an event


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: drop observations after first occurence of an event
Date   Fri, 19 Feb 2010 14:48:47 +0100

<> 

Raoul may also want to browse NJC`s FAQ:
http://www.stata.com/support/faqs/data/firstoccur.html




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von raoul reulen
Gesendet: Freitag, 19. Februar 2010 14:17
An: [email protected]
Betreff: st: drop observations after first occurence of an event

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/


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