Statalist


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

st: assigning dates with mutiple events and data split into 3 months interval


From   Camila Contessi <camilacontessi@hotmail.co.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: assigning dates with mutiple events and data split into 3 months interval
Date   Tue, 8 Sep 2009 14:08:26 +0100

Dear all,
I am doing a survival analysis on mutiple events, the data is split into 3 months interval.  Once the data is split, I would like to assing each 3 months a date the measurements of liver funtion is been taken that lies between the interval and if it has two measurements within each interval to take the first.
this is the command I am running in STATA 10
stset  exitdate, f(ckd) origin(time datefirstseen) enter(time datefirstseen) exit(time .) id (id) scale (30.45)
recast float  _t _t0, force
gen y= _t- _t0
labe var y "follow-up time in months*/
format _origin %d
stsplit time, every(3) 
sort id
merge id using `livf' /*then merge with serial measurments data*/

quietly forval i = 1/`= _N' {
        sort id exitdate datelliv  ///
             inrange((starf[`i']) (starf[`i'[_n-1]]),  - Date, 1, 232009)
    gen flag = r(N) in `i'
}

STATA comes back with "time-series operators not allowed"
I wnted to genrate the flag to indicate the date between 17/02/06 and 19/05/06, which is 01/03/2006. Not  sure what I am doing wrong, please could nay one help.
thanks very much
Kind Regards


id
  
  
            exitdate 

  
  
  dateliv
  
 
 
  
  111
  
  
  17-Feb-06
  
  
  01-May-08
  
 
 
  
  111
  
  
  19-May-06
  
  
  21-Nov-05
  
 
 
  
  111
  
  
  18-Aug-06
  
  
  12-Jan-06
  
 
 
  
  111
  
  
  17-Nov-06
  
  
  17-May-06
  
 
 
  
  111
  
  
  16-Feb-07
  
  
  16-Aug-06
  
 
 
  
  111
  
  
  18-May-07
  
  
  01-Mar-06
  
 
 
  
  111
  
  
  17-Aug-07
  
  
  06-Feb-07
 

_________________________________________________________________
Use Hotmail to send and receive mail from your different email accounts.
http://clk.atdmt.com/UKM/go/167688463/direct/01/
*
*   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