Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: data suppression in Stata


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: data suppression in Stata
Date   Mon, 2 Sep 2002 13:51:17 +0100

Rajiv Sinha

> I have a very large panel data set that looks as follows:
> people tracked over time and data on occurance of an event
> and a lot of time varying covariates (not shown below).
> Person       Time          Event Time       X
> 1                    1                      2                1
> 1                    2                       2                3
> 1                    3                       2                20
> 2                    1                       1                5
> 2                    2                       1                 6
> 2                    3                        1                9
> etc...
> I need to suppress these data as follows:  since the event occured
for
> person 1 at time 2 I want to drop all data pertaining to him for
period 3
> and keep data only for period 1 and 2.  Similarly for person 2,
since
> the event occured at time 1, I want to drop all data after this
point
> and keep data only for period 1.  The final data should be:
> Person       Time          Event Time       X
> 1                    1                      2                   1
> 1                    2                       2                 3
> 2                    1                       1                   5
> How do I do this in Stata?   Thanks in advance.

. keep if time <= eventtime

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

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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index