/** Compute survival probabilities using Bell & Miller (2005) life tables during the years of FEM simulation */ foreach yr in 1910 1920 1930 1940 1950 { local bellmillertabs `bellmillertabs' BellMiller2005_lifetables/BellMiller2005_cohort_lifetable_byr`yr'.dta } append using `bellmillertabs', gen(src) gen birthcohort = 1900 + 10 * src tab birthcohort gen year = birthcohort + age * keep only simulation years that overlap with CDC life tables drop if year < 2004 | year > 2016 sort male birthcohort year by male birthcohort: gen survprob = 1.0 if _n==1 by male birthcohort: replace survprob = 1.0 - qx if _n > 1 by male birthcohort: gen cumsurvprob = sum(ln(survprob)) replace cumsurvprob = exp(cumsurvprob) li year birthcohort age qx survprob cumsurvprob * drop odd years for merging with FEM results drop if mod(year,2)==1 drop if age < 51 | age > 99 drop if mod(year,2)==1 save data/bellmiller_survival.dta, replace