The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging DHS Files
Merging DHS Files [message #10086] Fri, 24 June 2016 02:19 Go to next message
Ansari is currently offline  Ansari
Messages: 3
Registered: April 2016
Location: Bangladesh
Member
Hi DHS Team,
I am facing problems in merging 3 datasets(MR,IR,PR). Neccessary information is spread across the 3 datasets. Such as -

# Referencing Azerbaizan 2006 DHS Data.
MR:
Blood Pressure Measurement
socio-demographic status
But no BMI/height/weight

IR:
Blood Pressure Measurement
socio-demographic status
BMI

PR:
height,weight,BMI for male and female.

Blood pressure measurement(hypertension) is the outcome variable in my analysis.

How can I combine all 3 datasets while retaining my required information.
I have applied the following method. But the ultimate file has no Blood Pressure Measurement.

http:// userforum.dhsprogram.com/index.php?t=msg&th=4900&sta rt=0&S=11929809d39055b64bc64410787bc2a2

If someone here who can guide me how to do this in SPSS, I will be grateful to you.
You can show it in STATA also.But I prefer SPSS.
Re: Merging DHS Files [message #10093 is a reply to message #10086] Mon, 27 June 2016 07:14 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

The following lines will do the merge, combining the IR and MR variables with the PR variables. It appears that more information was collected for women than for men, but I leave it to you to deal with that.

set more off
set maxvar 10000

use e:\DHS\DHS_data\IR_files\AZIR52FL.dta, clear
rename v001 hv001
rename v002 hv002
rename v003 hvidx
gen in_IR=1
sort hv001 hv002 hvidx
save e:\DHS\scratch\tempAZIR52.dta, replace

use e:\DHS\DHS_data\MR_files\AZMR52FL.dta, clear
rename mv001 hv001
rename mv002 hv002
rename mv003 hvidx
gen in_MR=1
sort hv001 hv002 hvidx
save e:\DHS\scratch\tempAZMR52.dta, replace

use e:\DHS\DHS_data\PR_files\AZPR52FL.dta, clear
gen in_PR=1
sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using e:\DHS\scratch\tempAZIR52.dta
tab _merge
drop _merge

sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using e:\DHS\scratch\tempAZMR52.dta
tab _merge
drop _merge
keep if in_PR==1 & (in_IR==1 | in_MR==1)
drop in_*
Previous Topic: ID variables for Children
Next Topic: 2014 Kenya DHS merging household and men's datafile
Goto Forum:
  


Current Time: Sun Dec 22 16:15:50 Coordinated Universal Time 2024