Commit d222dcc6 authored by Ben Anderson's avatar Ben Anderson
Browse files

updated descriptives script

2012 descriptives uses 20pc sample file
Long file descriptives loops over % samples
parent f1c588a2
......@@ -27,28 +27,34 @@ local rpath "`proot'/results/NEED"
local version "v1.1"
local do_2014_desc 0 /// quick tests for 2014
local do_long_dec 1 /// tests for all years using long file - takes a while
* quick tests for 2012
local do_2012_desc = 1
* tests for all years using long file - takes a while
local do_long_dec = 1
set more off
log using "`rpath'/analyse-NEED-EULF-2014-descriptives-`version'-$S_DATE.smcl", replace
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
if `do_2012_desc' {
* use a subsample for speed
local sample = "20pc"
* first use the wide file for basic descrpitives
use "`dpath'/need_eul_may2014_consumptionfile_wide_`sample'.dta", clear
* match in the xwave file with the vars we want
merge 1:1 HH_ID using "`dpath'/need_eul_may2014_xwavefile_`sample'", keepusing(EE_BAND FLOOR_AREA_BAND PROP_AGE)
* distributions for 2012 (to test)
* processor intensive
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
histogram `v' , by(`tv') name(histo_`tv'_`v'_`sample')
graph export "`rpath'/NEED-EULF-2014-histo_`v'_by_`tv'_`sample'.png", replace
graph box `v', over(`tv') name(box_`tv'_`v')
graph export "`rpath'/NEED-EULF-2014-box_`v'_by_`tv'.png", replace
graph export "`rpath'/NEED-EULF-2014-box_`v'_by_`tv'_`sample'.png", replace
}
}
}
......@@ -60,7 +66,7 @@ if `do_long_desc' {
foreach s of local samples {
di "************************"
di "* Using `s'% sample"
use "`dpath'/need_eul_may2014_longfile_`s'pc.dta", clear
use "`dpath'/need_eul_may2014_longfile_`s'.dta", clear
* set as panel
xtset HH_ID year, delta(1 year)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment