Hi all,
I have a dataset I am analysing using survival analyses, with multiple records per patient. I am looking to split up my survival analyses by survival time (e.g. 0-3 years and 3 years+), but I am having trouble working out how to do this.
I wrote the following code before my dataset was split into multiple records per patient, but this isn't working anymore with multiple records per patient, as each patient with multiple records has the same exit point now;
gen timezerothree=dodreg-dateofdiag
*replace timezerothree=lastfu_newformat-dateofdiag if dodreg==.
replace timezerothree=(min(lastfu_newformat,td(31dec2017))-dateofdiag) if dodreg==.
replace timezerothree=timezerothree/365.25
replace timezerothree=3 if timezerothree>3
replace timezerothree=0 if timezerothree==.
gen bcdeathstatus03=1 if timezerothree<3 & timezerothree>0 & bcdeathnew==1
replace bcdeathstatus03=0 if bcdeathstatus03==. & bcdeathnew!=.
replace timezerothree=. if bcdeathnew==.
stset timezerothree, fail(bcdeathstatus03==1) id(patientid)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Can someone please help me?
Related Posts with Splitting up survival analyses by follow-up time
Web scarping errorHello all, I downloaded the command nba2stata to get data from this website to STATA. However when …
Using postfile with xtregHi guys, I would like to perform a regression within a loop and store the results in excel. Ideally…
How I can egen a variable to capture the sum value of numbers in the different columnsDear Stata users, I am working on a dataset with many dummy variables. What I want to achieve is eg…
Error specifying multiple quantilesI am trying to run quantile regression with clustered standard errors. I would like to run .25, .5 .…
Can PPML be used beyond gravity models?Dear All, I am helping a friend with some Stata coding. I am myself not an expert. They have a cou…
Subscribe to:
Post Comments (Atom)
0 Response to Splitting up survival analyses by follow-up time
Post a Comment