Statalist


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

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


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: assigning dates with mutiple events and data split into 3 months interval
Date   Tue, 8 Sep 2009 14:14:25 +0100

This looks wrong: 

labe var y "follow-up time in months*/

Presumably you want 

labe var y "follow-up time in months" 

There is at least one other problem with your code. The loop will fail
second time round as -flag- will then already exist. 

I don't understand most of the details here, but your loop may need to
be rewritten something like 

gen flag = .

forval ... { 
	...
	count ...
	replace flag = r(N) in `i' 
} 

Nick 
[email protected] 

Camila Contessi

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.

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