From 09367a992ef739557d8bf24f77aa9ff20c20a1a1 Mon Sep 17 00:00:00 2001 From: Ben Anderson <b.anderson@soton.ac.uk> Date: Wed, 29 Apr 2015 15:56:54 +0100 Subject: [PATCH] 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. --- ONS-UK-EFS-time-series-extract.do | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ONS-UK-EFS-time-series-extract.do b/ONS-UK-EFS-time-series-extract.do index 445f4ec..9b6b5c3 100755 --- a/ONS-UK-EFS-time-series-extract.do +++ b/ONS-UK-EFS-time-series-extract.do @@ -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 -- GitLab