Hello! I would need some help with the coding of my stset for survival analysis. I have a population that i follow from their 34th birthday until either hospitalization for cardiovascular disease (main outcome), death or migration occurs. I want to end the followup time for those who die to their death date and for those who migrate i want to end the follow up on their migration date (except for cases where they experience a cardiovascular event before their death/migration date). So if migration date is the first event I want the followup time to end on that date, but if they are hospitalized and then migrate i want the followup time to end on the date of hospitalization. Those who die before hospitalization should end their followup on the death date but in cases where hospitalization occurs before hospitalization date should be used.
Variables:
fupt_cvd= followup time
ddate= death date
INDATUM_circulatory= date of hospitalization
emiDate= date of migration
emikeep= those in the population who have migrated and that i want to include in the sample (1 = include in sample)
2019,12,31 is the end of the study period - for those who do not experience any event this is the end of followup
This is my code currently, will this produce the right results?
gen fupt_cvd = min(ddate, INDATUM_circulatory) if !missing(ddate) & ! missing(INDATUM_circulatory)
format fupt_cvd %td
replace fupt_cvd = min(ddate,date("2019,12,31","YMD")) if !missing(ddate) & missing(INDATUM_circulatory)
replace fupt_cvd = min(INDATUM_circulatory,date("2019,12,31","YMD")) if !missing(INDATUM_circulatory) & missing(ddate)
replace fupt_cvd = date("2019,12,31","YMD") if missing(INDATUM_circulatory) & missing(ddate)
replace fupt_cvd = emiDate if emikeep==1 & missing(ddate) & missing(INDATUM_circulatory)
replace fupt_cvd = emiDate if emikeep==1 & emiDate<INDATUM_circulatory
stset fupt_cvd, failure(iscvd=1) origin(bdate_34) scale(365.25) id(LopNr)
0 Response to Problem with creating followup time for survival analysis accounting for disease, death and migration
Post a Comment