window push version 10.0 window push log using 8.8.2.Survival_to_PersonYears.log, replace window push * 8.8.2.Survival_to_PersonYears.log window push * window push * Convert survival data to person-year data. window push * The survival data set must have the following variables: window push * id = patient id, window push * age_in = age at start of follow-up, window push * age_out = age at end of follow-up, window push * fate = fate at exit: censored = 0, dead = 1, window push * treat = treatment variable. window push * window push * The person-year data set created below will contain one window push * record per unique combination of treatment and age. window push * window push * Variables in the person-year data set that must not be in the window push * original survival data set are window push * age_now = an age of people in the cohort, window push * pt_yrs = number of patient-years of observations of people window push * who are age_now years old, window push * deaths = number of events (fate=1) occurring in pt_yrs of window push * follow-up for this group of patients. window push * window push use C:\WDDtext\8.8.2.Survival.dta, clear window push list window push generate exit = age_out + 1 window push stset exit, id(id) enter(time age_in) failure(fate) window push stsplit age_now, at(0(1)6) window push list id age_in age_out treat fate exit age_now window push sort treat age_now window push collapse (count) pt_yrs=age_in (sum) deaths=fate, by (treat age_now) window push list treat age_now pt_yrs deaths window push save 8.8.2.Person-Years.dta, replace window push log close