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

added code to create a generic birth decade cohort variable

parent ef960dde
No related branches found
No related tags found
No related merge requests found
......@@ -68,14 +68,14 @@ 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 - these will be 'kept' (along with case and ba_* or c_* after the var names have been reduced to lower case
* basic weighting & consumption expenditure codes
local dvhh_keepvars = "weight* p60*t p61*t p630tp"
local dvhh_keepvars = "weight* p60*t p61*t p630* p396*"
* needed for income equivalisation later
local dvhh_keepvars = "`dvhh_keepvars' incanon a055 g018 g019 p116* p344* p389*"
* DEMAND 2.3 (older people mobile lives)
......@@ -361,10 +361,11 @@ if `do_extracts' {
/* 1st adult = .67 spouse = .33 other 2nd adult = .33 3rd adult = .33 subsequent adults = .33 children aged < 14 = .2 children aged 14+ = .33 */ * catch hh with no children replace ba_under14 = 0 if ba_under14 == . replace ba_over14 = 0 if ba_over14 == . gen oecd_equivbhcwt = 0.67 if ba_adults >= 1 replace oecd_equivbhcwt = oecd_equivbhcwt + ((ba_adults-1) * 0.33) + (ba_under14 * 0.2) + (ba_over14 * 0.33) di "Calculating equiv income (OECD) and quartiles/deciles"
* p344 & p389 changed to *p after 2006 and top coded (!)
* p344, p389 & p396 changed to *p after 2006 and top coded (!)
if `y' > 2005 {
rename p344p p344
rename p389p p389
rename p396p p396
}
gen equiv_p344 = p344/oecd_equivbhcwt
......@@ -397,6 +398,15 @@ if `do_extracts' {
gen ba_month = a055
* create a birth cohort variable
* remember that after 2005 age is top coded to 80
* year of birth
gen ba_birthyear = ba_sampyear - p396
* create a birth cohort variable
recode ba_birth (1910/1919=1) (1920/1929=2) (1930/1939=3) (1940/1949=4) (1950/1959=5) (1960/1969=6) (1970/1979=7) (1980/1989=8) (1990/1999=9) (2000/2009=10), gen(ba_birth_cohort)
lab def ba_birth_cohort 1 "1910-1919" 2 "1920-1929" 3 "1930-1939" 4 "1940-1949" 5 "1950-1959" 6 "1960-1969" 7 "1970-1979" 8 "1980-1989" 9 "1990-1999" 10 "2000-2009"
lab val ba_birth_cohort ba_birth_cohort
* tab ba_birth_cohort c_age, mi
***********************
* End of per-year processing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment