diff --git a/NEED/analyse-NEED-EULF-2014-descriptives.do b/NEED/analyse-NEED-EULF-2014-descriptives.do index 4b0b5385b16f12856b1a19f97966504ba1b14a16..6350117c77c0a39773a72fdfe62c9607e48e99a3 100644 --- a/NEED/analyse-NEED-EULF-2014-descriptives.do +++ b/NEED/analyse-NEED-EULF-2014-descriptives.do @@ -23,27 +23,52 @@ local proot "`home'/Work/Data/Social Science Datatsets/DECC" * for clam * local proot "`home'/Work/NEED" local dpath "`proot'/NEED/End User Licence File 2014/processed" -local rpath "`proot'/results/NEED/" +local rpath "`proot'/results/NEED" local version "v1.1" +local do_2014_desc 1 /// quick tests for 2014 +local do_long_dec 0 /// tests for all years using long file - takes a while + set more off log using "`rpath'/analyse-NEED-EULF-2014-descriptives-`version'-$S_DATE.smcl", replace -* use the pre-processed long form file which contains all years of consumption data but not the constant values (housing charactersitics etc) which are in the xwave file -use "`dpath'/need_eul_may2014_longfile.dta", clear - -table EconsValid year, c(count Econs min Econs mean Econs max Econs) -table GconsValid year, c(count Gcons min Gcons mean Gcons max Gcons) +if `do_2014_desc' { + * first use the original file for basic descrpitives + use "`proot'/NEED/End User Licence File 2014/UKDA-7518-stata11/stata11/need_eul_may2014.dta", clear + + * distributions for 2012 (to test) + local vars "Econs2012 Gcons2012" + local tvars "EE_BAND FLOOR_AREA_BAND PROP_AGE" + foreach v of local vars { + foreach tv of local tvars { + histogram `v' , by(`tv') name(histo_`tv'_`v') + graph export "`rpath'/NEED-EULF-2014-histo_`v'_by_`tv'.png", replace + + graph box `v', over(`tv') name(box_`tv'_`v') + graph export "`rpath'/NEED-EULF-2014-box_`v'_by_`tv'.png", replace + } + } +} -* distributions -local vars "Econs Gcons" -foreach v of local vars { - histogram `v', by(year) name(histo_`v') - graph export using "`rpath'/NEED-EULF-2014-histo_`v'_by_year.png", replace - graph box `v', by(year) name(box_`v') - graph export using "`rpath'/NEED-EULF-2014-box_`v'_by_year.png", replace +if `do_long_desc' { + * Now use the pre-processed long form file which contains all years of consumption data but not the constant values (housing charactersitics etc) which are in the xwave file + use "`dpath'/need_eul_may2014_longfile.dta", clear + + * summarise Electricity + table EconsValid year, c(count Econs min Econs mean Econs max Econs) + * summarise Gas + table GconsValid year, c(count Gcons min Gcons mean Gcons max Gcons) + + * distributions by year + local vars "Econs Gcons" + foreach v of local vars { + histogram `v', by(year) name(histo_`v') + graph export "`rpath'/NEED-EULF-2014-histo_`v'_by_year.png", replace + graph box `v', over(year) name(box_`v') + graph export "`rpath'/NEED-EULF-2014-box_`v'_by_year.png", replace + } } di "* Done!"