The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging IR and PR 2016 UDHS (Matching a variable from IR and PR give wrong number of women)
Re: Merging IR and PR 2016 UDHS [message #20010 is a reply to message #19996] Tue, 15 September 2020 07:44 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The following Stata code will do the IR/PR merge. You then need to reduce to cases with _merge=3 and with responses to the disability questions. You will want to retain more variables from both files than I did.

All the women in the IR file are in the PR file. The women in the PR file who are eligible for the IR file, on the basis of age and residency, is given by hv117=1. Good luck!


* merge IR and PR, Uganda 2016

* Prepare IR file
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\UGIR7BFL.DTA", clear

* keep the variables you want
keep v0*
sort v001 v002 v003
save e:\DHS\DHS_data\scratch\UGIRtemp.dta, replace

* Prepare PR file and merge
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\UGPR7BFL.DTA", clear
* reduce to women who are eligible for the IR file
keep if hv117==1

* keep the variables you want
keep hv0* sa33 sh*

rename hv001 v001
rename hv002 v002
rename hv003 v003

sort v001 v002 v003
merge v001 v002 v003 using e:\DHS\DHS_data\scratch\UGIRtemp.dta
tab _merge
 
Read Message
Read Message
Previous Topic: Weighing countries in a multi-country study
Next Topic: How to merge a person-level data with a child-level data
Goto Forum:
  


Current Time: Sun Dec 22 05:36:09 Coordinated Universal Time 2024