Skip to content
Snippets Groups Projects
Commit 09367a99 authored by Ben Anderson's avatar Ben Anderson
Browse files

altered to provide a mechanism to extract a bespoke set of variables from the dvhh file

due to:
- variables in upper case after 2009 (why?)
- mis-matching variable types in different years (why?)

This made it complicated to use a core set of variables and match year
by year.
parent e0fef6d9
No related branches found
No related tags found
No related merge requests found
......@@ -68,13 +68,17 @@ local years "2001-2012" // just a label
local all_years "2001-2002 2002-2003 2003-2004 2004-2005 2005-2006 2006 2007 2008 2009 2010 2011 2012" // years to process local do_years = "2001-2002 2002-2003 2003-2004 2004-2005 2005-2006 2006 2007 2008 2009 2010 2011 2012"
* set to 1 to refresh each yearly extract you listed in do_years
local do_extracts 0
local do_extracts 1
* drop the first survey for the merge as it is loaded first
local mergeyears = "2002-2003 2003-2004 2004-2005 2005-2006 2006 2007 2008 2009 2010 2011 2012"
* be sure to keep only these from the dv hh file - last ones needed for income equivalisation later
local dvhh_keepvars = "incanon weight* a055 g018 g019 p116* p344* p389*"
* be sure to keep only these from the dv hh file - these will be 'kept' after the var names have been reduced to lower case
* DEMAND 2.3 (older people mobile lives)
local dvhh_keepvars = "b480 b481 c96111* c96112* cc5413* c73311* c73312*"
* needed for income equivalisation later
local dvhh_keepvars = "`dvhh_keepvars' incanon weight* a055 g018 g019 p116* p344* p389*"
capture log close
log using "`logd'/ONS-UK-EFS-time-series-extract-$S_DATE.smcl", replace
......@@ -137,10 +141,13 @@ if `do_extracts' {
* could use g019?
* has 1, 2 and more than 2 - so needs recoding. recode c_nchild (0=0) (1=1) (2/max=2) lab var c_nchild "Constraint: number of children" lab define c_nchild 0 None 1 One 2 "Two or more" lab val c_nchild c_nchild ** Sorting sort case
* has 1, 2 and more than 2 - so needs recoding. recode c_nchild (0=0) (1=1) (2/max=2) lab var c_nchild "Constraint: number of children" lab define c_nchild 0 None 1 One 2 "Two or more" lab val c_nchild c_nchild
gen ba_year = `y'
** Sorting sort case
* keep only basic variables
keep case* c_* region `dvhh_keepvars'
keep case* ba_* c_* region `dvhh_keepvars'
qui: compress * save all vars save "`efsd'/`y'/stata/dvhh-temp.dta", replace ****************************** di "* raw household file for c_comp and c_accom"
* also to pick up electricity water payments periodicity etc for error analysis use "`efsd'/`y'/stata/rawhh.dta", clear
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment