cap program drop initial_intervention program define initial_intervention syntax [varlist] [if] [in], init_interventions(string) is_startyr(integer) marksample touse /*, zeroweight strok novarlist */ *** Modify initial dataset before any simulation *scenario: specific intervention scenario *Year of cohort *** Scenarios changed on Dec 19, 2007 *** Obesity prevention, consider both one-time therapy and lifetime therapy * dis "************* Begin initial intervention ************" * dis "Intervention is : `scenario' " *** Provide insurance to the uninsured, reduce hypertension *** Sep 18, 2008, distinguish whether it is for the starting year or later ***************************************** * If for the starting year, generate variables ***************************************** if `is_startyr' { gen treat_now = . if `touse' gen treat_effective = . if `touse' gen treat_ever = . if `touse' foreach x in smoken diabe hibpe obese { gen llf`x' = . if `touse' gen lf`x' = . if `touse' } gen ltreat_ever = . if `touse' * Record status before intervention - Aug 31,2008 foreach x in smoken diabe hibpe obese { cap drop old_`x' gen old_`x' = `x' if `touse' } gen treat_hibpe = . if `touse' gen treat_diabe = . if `touse' gen treat_hibpe_eff = . if `touse' gen treat_diabe_eff = . if `touse' gen treat_hibpe_evr = . if `touse' gen treat_diabe_evr = . if `touse' gen ltreat_hibpe_evr = . if `touse' gen ltreat_diabe_evr = . if `touse' } else { foreach x in smoken diabe hibpe obese { replace old_`x' = `x' if `touse' } } replace treat_now = 0 if `touse' if length(trim("`init_interventions'")) > 0 { * Run some interventions noi di "******** Running Initial Interventions ********" foreach intervene in `init_interventions' { noi di _column(10) "`intervene'" noi `intervene'_intervene0 if `touse', is_startyr(`is_startyr') } } else { * No interventions to run noi di "******** No initial interventions, Running Baseline ********" qui replace treat_now = 0 if `touse' } replace treat_ever = treat_now if `touse' replace ltreat_ever = 0 if `touse' /* Aug 31, Ever conditions for the summary of cases averted */ quietly{ foreach x in smoken diabe hibpe obese { replace llf`x' = 0 if `touse' replace lf`x' = old_`x'== 1 & `x' == 0 if `touse' } } end