The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging 2018 Zambia HR to IR (Need help merging 2018 Zambia HR to IR)
Re: Merging 2018 Zambia HR to IR [message #26060 is a reply to message #26058] Thu, 02 February 2023 16:16 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3150
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

The following Stata lines will merge the PR and IR files, with one record for each woman in the IR file. Hope this is what you are looking for.

* PR/IR merge for ZM71, Zambia 2018 DHS

* specify a workspace
cd e:\DHS\DHS_data\scratch

use "...ZMIR71FL.DTA", clear
gen cluster=v001
gen hh=v002
gen line=v003
sort cluster hh line
save ZMIRtemp.dta, replace 


use "...ZMPR71FL.DTA", clear 
keep if hv117==1
gen cluster=hv001
gen hh=hv002
gen line=hvidx
sort cluster hh line
merge cluster hh line using ZMIRtemp.dta

tab _merge
keep if _merge==3
drop _merge

* save this file with another name

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging BR and PR files - India - NFHS 1998
Next Topic: Merge IR and KR
Goto Forum:
  


Current Time: Fri Aug 30 08:05:55 Coordinated Universal Time 2024