The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Mother's and Father's occupation
Mother's and Father's occupation [message #9311] Tue, 08 March 2016 19:30 Go to next message
Norini is currently offline  Norini
Messages: 1
Registered: March 2016
Member
Dear all,

I am trying to do a child labour analysis and need info on mother and father of 5-14 years old children. I have been able to generate mother and father education using the household member recode data from Mali 2001 however I need a variable for mother and father's occupation which I think can be found in women IR dataset. Can anybody assist me on how to generate this variable and merge it to household member recode dataset ? Thank you.
Re: Mother's and Father's occupation [message #9324 is a reply to message #9311] Thu, 10 March 2016 11:15 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

The following Stata lines will do this merge. You must add the other variables you want to retain in the "keep" lines and you must change the paths. I am using the old version of "merge" but it still works in Stata 14.

* Prepare IR file
use e:\DHS\DHS_data\IR_files\MLIR41FL.dta, clear
rename v001 hv001
rename v002 hv002
rename v003 hv112
* bring along more variables if you want
keep hv001 hv002 hv112 v716 v717 v704 v705
gen mother_present=1
sort hv001 hv002 hv112
save e:\DHS\DHS_data\scratch\temp_IR.dta, replace

* Prepare MR file
use e:\DHS\DHS_data\MR_files\MLMR41FL.dta, clear
rename mv001 hv001
rename mv002 hv002
rename mv003 hv114
* bring along more variables if you want
keep hv001 hv002 hv114 mv716 mv717
gen father_present=1
sort hv001 hv002 hv114
save e:\DHS\DHS_data\scratch\temp_MR.dta, replace

* Prepare PR file
use e:\DHS\DHS_data\PR_files\MLPR41FL.dta, clear
keep if hv105>=5 & hv105<=14
* bring along more variables if you want
keep hv001 hv002 hvidx hv104 hv105 hv112 hv114

* Merge with mother's data
sort hv001 hv002 hv112
merge hv001 hv002 hv112 using e:\DHS\DHS_data\scratch\temp_IR.dta
tab _merge
drop if _merge==2
drop _merge
replace mother_present=0 if mother_present==.
tab hv105 mother_present

* Merge with father's data
sort hv001 hv002 hv114
merge hv001 hv002 hv114 using e:\DHS\DHS_data\scratch\temp_MR.dta
tab _merge
drop if _merge==2
drop _merge
replace father_present=0 if father_present==.
tab hv105 father_present

tab mother_present father_present
Previous Topic: Merging Birth's Recode and Household Member Recode
Next Topic: Couples and HIV merge in STATA
Goto Forum:
  


Current Time: Thu Mar 28 11:18:37 Coordinated Universal Time 2024