***=======================================================* * FEM scenario combination * Mar 2008 ***=======================================================* clear set more off set mem 500m ***=============================* global workdir "/zeno/a/DOL/Model_yh" global indata "/zeno/a/DOL/Input_yh" global indata2 "/zeno/a/DOL/Indata_yh" global outdata "/zeno/a/DOL/Output_ahg" global tabdata "/zeno/a/DOL/Tables_ahg" *global scnr "status_quo multi_r nosmoke_r" global scnr "status_quo obese_r" global scnr "status_quo obese_r invobese_r nosmoke_r shareprev notrend" global scnr "status_quo" #d; global keepvar1 pop pop65p fracss62 fracss65 obese overwt diabe hearte hibpe ; global keepvar2 work ry_earn ssclaim ttl_ssben ttl_diben ttl_ssiben ttl_ftax ttl_stax ttl_ctax ttl_hoasi ttl_hmed ; global keepvar3 ttl_caremd ttl_caidmd ttl_totmd mhhwealth mry_earnwork; #d cr foreach scr in $scnr { drop _all use "$outdata/51p_s`scr'_c.dta" gen pop65p = pop * (1 - dage5164) keep year $keepvar1 $keepvar2 $keepvar3 keep if year == 2004 | year == 2006 | year == 2030 | year == 2050 foreach v in $keepvar1 $keepvar2 $keepvar3 { ren `v' `v'_`scr' } sort year, stable save temp_`scr'.dta, replace local sc `scr'_only #d; outsheet year pop* fracss* obese* overwt* diabe* hearte* hibpe* work* ry_earn* ttl_ftax* ttl_stax* ttl_ctax* ttl_hoasi* ttl_hmed* ttl_ssben* ttl_diben* ttl_ssiben* ttl_caremd* ttl_caidmd* ttl_totmd* mhhwealth* mry_earnwork* using "$tabdata/scr_`sc'_sep17.csv", replace comma nol; #d cr if "`scr'" != "status_quo"{ merge year using temp_status_quo.dta *erase temp_`scr'.dta drop _merge* foreach x in $keepvar1 $keepvar2 $keepvar3 { foreach s in `scr'{ * replace `x'_`s' = (`x'_`s' - `x'_status_quo) * 100/ `x'_status_quo replace `x'_`s' = (`x'_`s' - `x'_status_quo)/ `x'_status_quo } } drop *status_quo local sc `scr' #d; outsheet year pop* fracss* obese* overwt* diabe* hearte* hibpe* work* ry_earn* ttl_ftax* ttl_stax* ttl_ctax* ttl_hoasi* ttl_hmed* ttl_ssben* ttl_diben* ttl_ssiben* ttl_caremd* ttl_caidmd* ttl_totmd* mhhwealth* mry_earnwork* using "$tabdata/scr_`sc'_sep17.csv", replace comma nol; #d cr } } foreach s in status_quo multi_r nosmoke_r obese_r invobese_r notrend { cap erase temp_`s'.dta }