The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging household and husbands' info to women
Re: merging household and husbands' info to women [message #4025 is a reply to message #3976] Wed, 18 March 2015 12:18 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3139
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata specialist, Tom Pullum:

First, you refer to a Kenya 2010 survey. I will assume that you mean the Kenya 2008-09 survey. I can't find a Kenya 2010 DHS.

Second, when you do these merges, you do not need to include v022. That variable is always determined by v001 and it is superfluous to include it.

If you are only interested in women who are in couples, then it would be simpler to merge the PR file and CR file directly, using the woman's id. For example, you could do the following lines:

* These lines will attach the CR variables to the PR file, using
* the id for the woman, not the man

* You must change the paths

use c:\DHS\DHS_data\CR_files\KECR52FL.dta, clear
gen hv001=v001
gen hv002=v002
gen hvidx=v003
sort hv001 hv002 hvidx
save c:\DHS\DHS_data\CR_files\temp.dta, replace

use c:\DHS\DHS_data\PR_files\KEPR52FL.dta, clear
sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using c:\DHS\DHS_data\CR_files\temp.dta
tab _merge
keep if _merge==3
drop _merge

Here is how I would have done your merge of the IR and PR files

* These lines will attach the IR variables to the PR file, using
* the id for the woman, not the man

* You must change the paths

use c:\DHS\DHS_data\IR_files\KEIR52FL.dta, clear
gen hv001=v001
gen hv002=v002
gen hvidx=v003
sort hv001 hv002 hvidx
save c:\DHS\DHS_data\IR_files\temp.dta, replace

use c:\DHS\DHS_data\PR_files\KEPR52FL.dta, clear
sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using c:\DHS\DHS_data\IR_files\temp.dta
tab _merge
keep if _merge==3
drop _merge

* Then can attach the CR variables if you want

Please let me know if I have not correctly understood what you want to do.

 
Read Message
Read Message
Read Message
Previous Topic: merging IR and HIV
Next Topic: Mergining PR onto a Combined IR, MR Dataset in SPSS
Goto Forum:
  


Current Time: Mon Aug 19 05:17:28 Coordinated Universal Time 2024