From 7231026e3af85be150d99bc1555e76fcdc8652cd Mon Sep 17 00:00:00 2001
From: Ben Anderson <b.anderson@soton.ac.uk>
Date: Mon, 13 Oct 2014 15:54:38 +0100
Subject: [PATCH] updated valid codes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

checked for transitions between different ‘valid observation’ states
---
 NEED/analyse-NEED-EULF-2014-descriptives.do | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/NEED/analyse-NEED-EULF-2014-descriptives.do b/NEED/analyse-NEED-EULF-2014-descriptives.do
index 790561a..a000d89 100644
--- a/NEED/analyse-NEED-EULF-2014-descriptives.do
+++ b/NEED/analyse-NEED-EULF-2014-descriptives.do
@@ -79,7 +79,7 @@ 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
 	* do this for each random sample of differening sizes as a check
 	* local samples "10 20 30 40 50 100"
-	local samples "50"
+	local samples "10"
 	foreach s of local samples {
 		di "************************"
 		di "* Using `s'% sample"
@@ -116,11 +116,17 @@ if `do_long_desc' {
 				graph export "`rpath'/NEED-EULF-2014-`s'pc-box_`v'_by_year_valid.png", replace 
 			}
 			* check the panel transitions for each valid
-			recode `v'Valid (V = 1) (O = 2) (L = 3) (G = 4) (M = 5), gen(EconsValidr)
+			gen `v'Validr = 1 if `v'Valid == "V"
+			replace `v'Validr = 2 if `v'Valid == "O"
+			replace `v'Validr = 3 if `v'Valid == "L"
+			replace `v'Validr = 4 if `v'Valid == "G"
+			replace `v'Validr = 5 if `v'Valid == "M"
+			
 			lab var `v'Validr "Recoded `v'Valid"
-			lab def `v'Validr 1 "V" 2 "O" 3 "L" 4 "G" 5 "M"
+			lab def `v'Validr 1 "(V)alid" 2 "(O)ff-gas" 3 "(L)Gas < 100" 4 "(G) Gas > 50,000" 5 "M(issing in source)"
 			lab val `v'Validr `v'Validr
-			xttrans `v'Validr
+			* di "Check transitions (`v'Validr)"
+			xttrans `v'Validr, freq
 		}
 	}
 }
-- 
GitLab