From ba1f62fe42bd7abaca7963e9b1679809623c8940 Mon Sep 17 00:00:00 2001
From: Ben Anderson <b.anderson@soton.ac.uk>
Date: Wed, 29 Apr 2015 17:03:24 +0100
Subject: [PATCH] added method to keep vars from raw hh file

---
 ONS-UK-EFS-time-series-extract.do | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/ONS-UK-EFS-time-series-extract.do b/ONS-UK-EFS-time-series-extract.do
index 9b6b5c3..8cfe008 100755
--- a/ONS-UK-EFS-time-series-extract.do
+++ b/ONS-UK-EFS-time-series-extract.do
@@ -76,10 +76,13 @@ local mergeyears = "2002-2003 2003-2004 2004-2005 2005-2006 2006 2007 2008 2009
 * 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*"  	
 
+* keep these from rawhh file
+* DEMAND 2.3 (older people mobile lives)
+local rawhh_keepvars = "flydes*"
+
 capture log close
 log using "`logd'/ONS-UK-EFS-time-series-extract-$S_DATE.smcl", replace
 
clear all
@@ -148,9 +151,8 @@ if `do_extracts' {
 		* keep only basic variables
 		 
 		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
		
+		qui: compress
		* save all vars
		save "`efsd'/`y'/stata/dvhh-temp.dta", replace
		
		******************************
		di "* raw household file for c_comp and c_accom"
+		di "* also to pick up `rawhh_keepvars'"
		
		use "`efsd'/`y'/stata/rawhh.dta", clear
		
 		* 2010 onwards data = mixed/uppercase
 		if "`y'" == "2010" | "`y'" == "2011" | "`y'" == "2012" {
 			rename *, lower	
@@ -178,7 +180,6 @@ if `do_extracts' {
 					*di in red "weight does not exist"
                }
             }
-			keep case* ba_*
 			di "* Done setting up sample year for `y'"
 		}
 
@@ -198,10 +199,10 @@ if `do_extracts' {
                }
             }
 			lab var ba_sampyear "Sample year"
-			keep case* ba_*
+			
 			di "* Done setting up sample year for `y'"
 		}
-				
+		keep case* ba_* `rawhh_keepvars'		
 		* Useful vars already 'kept'
 		* fix name
 		renpfix ba_c_ c_
-- 
GitLab