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
problem unbalanced panel data for threshold modelsDear all i'm working on pay PHD thesis and i will use the threshold model but ,unfortunately, i can…
Creating a year identifier for pre-post analysis to use for diff-in-diffHello All, I am new to posting on statalist. I hope my question is clear and happy to clarify if it…
Time series dataHi everyone, I am new to STATA so I am sorry if this is a silly question. I am researching oil price…
Change of sign on coefficient and and r squared when supressing constant. How to interpret the results?Hi I am trying to estimate a system of equations concerning the effect of FDI on Business cycle syn…
Percentage point function of skew t distributionDear all, I am using the command skewtreg from SJ to fit a skew t distribution. Subsequently, I run…
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