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
Binary Endogenous variable in Negative binomial regressionHello everybody, In my research, the dependent variable (DV) is count data and endogenous variable …
Gravity estimation including fixed effectsHi everyone, I am estimating a gravity model of trade including exporter-time and importer-time fix…
What does "log using 'filename', replace" do? To create logs or to replace the existing ones?Dumb question, but in my professor's notes it's to "create log in current folder." But isn't it foll…
Merging multiple panel data filesHello all, I have individual panel data and two state-level panels I seek to merge together. I have…
What are some Stata skills that you need to do RA for professors? And what are the good sources to learn data cleaning?I'm about to work as a RA for a professor, what would I be expected to do? I have heard that data cl…
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