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
Error "Option not allowed" when creating coefHey guys, my goal is to regress the natural logarithm of total industry sales and an index variable…
Stata Journal Editors' Prize 2020: Congratulations to Daniel Klein!The Editors of the Stata Journal (H. Joseph Newton and myself) are delighted to announce the award o…
Can factor variables and factorial interactions be used in "parmby"? If not, what is the alternative?Dear all, I wish to make a dataset of estimates - the treatment coefficient by year and its 95% con…
Testing equality of Poisson regression coefficients in two groups using ppmlhdfeDear all, How do you test Poisson coefficients in two groups? Because I have multi-way fixed effect…
how to code the following on statai have a group of friends around 50 .. and all make a choice of colour pink 10 , red 6 , black 10 , …
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