The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Merging datasets (Disability and women's questionnaire)
Re: Merging datasets [message #24027 is a reply to message #24024] Fri, 04 February 2022 11:08 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3199
Registered: February 2013
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The line number is the same for all these types of data. The following lines illustrate a PR / IR merge for the latest Rwanda survey. I put the PR file first and then the IR file but the reverse order will give the same result. Note that I need a place to save the sorted PR file. Besides the hdis and d variables I only keep the hv0* and v0* variables but you can keep whatever you want.


cd e:\DHS\DHS_data\scratch

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\RWPR81FL.DTA" , clear
keep if hv117==1
keep hv0* hvidx hdis*
gen cluster=hv001
gen hh=hv002
gen line=hvidx
sort cluster hh line
save RWPRtemp.dta, replace

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\RWIR81FL.DTA" , clear
keep v0* d*
gen cluster=v001
gen hh=v002
gen line=v003
sort cluster hh line
merge 1:1 cluster hh line using RWPRtemp.dta

keep if _merge==3
drop _merge
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Create a daughters' file on Stata
Next Topic: Cervical cancer Rwanda 2019
Goto Forum:
  


Current Time: Sat Nov 30 04:39:59 Coordinated Universal Time 2024