Statalist


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

st: RE: Dropping observation after it has 'failed'


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Dropping observation after it has 'failed'
Date   Mon, 13 Oct 2008 15:35:07 +0100

I don't understand Q.2. 

Q.1 I read as saying that you don't want observations once you have
observed -event == 1-. I wouldn't necessarily -drop- them; I would just
set them on one side. 

The time when -event- is 1 -- assuming that that occurs at most once in
each panel -- can be put in a variable by 

egen whenone = total(time * (event == 1)), by(id) 

Note that if -event- is never 1, then -whenone- will be 0. 

Then you might wish to select 

... if time <= whenone | whenone == 0 

-- or whatever makes sense in this territory. 

Nick 
n.j.cox@durham.ac.uk 

Anders Ryom Villadsen

 I'm a relatively new Stata user doing discrete event history models 
with two questions regarding data handling. I have browsed manuals and 
the list archive but cannot seem to find an answer to my questions that 
works.
My data looks like this.

id  time  event  indep1 .....
1    1       0        1
1    2       0        0
1    3       1        0
1    4       0        0  
etc.....

1) How do I drop the observation for time 4 (after org1 has 'failed') 
and it should no longer be part of my cloglog or logit models?
2) I want my indep var to work for two periods. How do I do that without

making it work for period 3?


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index