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)
Merging IR and PR 2016 UDHS [message #19996] Sat, 12 September 2020 06:32 Go to next message
gusblocaq is currently offline  gusblocaq
Messages: 1
Registered: September 2020
Member
I have managed to merge IR and PR one to one (thought IR should be base, have also tried PR as base to see the difference). I am looking into the variables of "Getting medical help for self" and want to assess the perceived barriers with disability (PR file only). When merged it looks alright, I am getting the number of women answered "getting medical help" to 18505 which is in line. Number of women 15-49 who answered the disability module is a bit more which makes sense. Problem is when you match them (cross-tabulation) the number of women reduces to 8560. What could I be doing wrong?


I've tried everything I have found on websites and forums etc when it comes to merging (using v001, v002,v003) and tried to limit the PR dataset to only contain women age 15-49 but I am still getting the same result. I also tried merging one to many (using v001, v002, v003) but it don't work, get the error.

I would assume the women in IR will be in the PR so honestly a bit confused to why it doesn't work?

Thanks in advance!
Camilla
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
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:20:00 Coordinated Universal Time 2024