Hi, I wondered if anyone could help tell me which is the correct syntax here.
I have a large data set where I want to risk, using a multivariate cox model, of surgery in people with an inflammatory bowel condition. I want to include people that only have at least 2 years of follow up and restrict the analysis to 2 years ie. look at what their risk of surgery was by 2 years of follow up from their time diagnosis.
The two syntax I have are ;
1.
stset exit, origin(diagnosis_date1) failure(elective) scale(365.25) id(patid) enter(diagnosis_date1) exit(exit)
stsplit twoyears, at(2)
keep if twoyears == 2
xi: stcox i.gender i.imd ib8.region i.diagnosis_age_cat i.charlson_fin i.diag_year_cat
or
2.
stset exit, failure(elective) scale(365.25) origin(diagnosis_date) id(patid) exit(time diagnosis_date + 2*365.25)
xi: stcox i.gender i.imd ib8.region i.diagnosis_age_cat i.charlson_fin i.diag_year_cat
I found the second code on stata forum from someone who was looking at something similar but getting different results with each so if someone could explain which is correct I would be most grateful!
Thanks
I have a large data set where I want to risk, using a multivariate cox model, of surgery in people with an inflammatory bowel condition. I want to include people that only have at least 2 years of follow up and restrict the analysis to 2 years ie. look at what their risk of surgery was by 2 years of follow up from their time diagnosis.
The two syntax I have are ;
1.
stset exit, origin(diagnosis_date1) failure(elective) scale(365.25) id(patid) enter(diagnosis_date1) exit(exit)
stsplit twoyears, at(2)
keep if twoyears == 2
xi: stcox i.gender i.imd ib8.region i.diagnosis_age_cat i.charlson_fin i.diag_year_cat
or
2.
stset exit, failure(elective) scale(365.25) origin(diagnosis_date) id(patid) exit(time diagnosis_date + 2*365.25)
xi: stcox i.gender i.imd ib8.region i.diagnosis_age_cat i.charlson_fin i.diag_year_cat
I found the second code on stata forum from someone who was looking at something similar but getting different results with each so if someone could explain which is correct I would be most grateful!
Thanks