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)
Related Posts with Problem with creating followup time for survival analysis accounting for disease, death and migration
Adoupdate not working in new installationDear users, I recently installed Stata 15 in a new machine with Windows 10. I first download -ftools…
How to test for multiple instruments in in etregress or eregressDear all: I am using Stata 15 to run a linear regression with endogenous treatment aiming to do inst…
Combine multiple columns into oneHi all, If there is a loop like following: Code: forv y = 2009/2012 { forv p = 1/20 { egen `…
snapshot with descriptive names instead of numbersI just upgraded to Stata 16 today and I was experimenting with the new frames feature. This allows a…
Two variables combined fixed effect with clustered standard errors of another variableHi Stata community, I have an unbalanced panel data set for the years 1992-2018 across different ye…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with creating followup time for survival analysis accounting for disease, death and migration
Post a Comment