labeldefineregion1"North East"2"North West & Merseyside"3"Yorkshire and the Humber"4"East Midlands"5"West Midlands"6"Eastern"7"London"8"South East"9"South West"10"Wales"11"Scotland"12"Northern Ireland"
labvarregion"Govt. Office Region"
labvalregionregion
** Number of children - 16 or younger.
*Object =
* 0 0
* 1 1
* 2 2+.
genc_nchild=a040+a041+a042
* could use g019?
* has 1, 2 and more than 2 - so needs recoding.
recodec_nchild(0=0)(1=1)(2/max=2)
labvarc_nchild"Constraint: number of children"
labdefinec_nchild0None1One2"Two or more"
labvalc_nchildc_nchild
genba_year=`y'
* construct list of vars to keep
* if dvhh_keepvars is empty STATA will skip
localkeepvars=""
foreachvoflocaldvhh_keepvars{
di"* Testing for existence of `v'"
captureconfirmvariable`v'
if!_rc{
di"* found `v'"
localkeepvars="`keepvars' `v'"
}
else{
* exact string not found as a variable, could be because it needs expansion
* try as a varlist (forces expansion)
di"* Not found, expanding `v'"
capturenoisily{
* if variable really doesn't exist this throws an exception & moves on
foreachvtofvarlist`v'{
captureconfirmvariable`vt'
if!_rc{
di"* -> found `vt'"
localkeepvars="`keepvars' `vt'"
}
}
}
}
}
di"* dvhh: keeping case* ba_* c_* region weight* `keepvars'"