The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merge PR and KR in wave 3, b16 does not exist
Re: Merge PR and KR in wave 3, b16 does not exist [message #15192 is a reply to message #14961] Thu, 14 June 2018 11:06 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1785
Registered: February 2013
Senior Member
Following is a response from DHS Technical Specialist, Shireen Assaf:

The following code should work for a KR PR merge. I'm using the Rwanda most recent survey as an example.


use RWKR70FL.DTA, clear             
               
               rename v001 hv001
               rename v002 hv002
               rename b16  hvidx
               
               * dropping those that are not in the household so we can merge with PR file
               drop if hvidx==0 | hvidx==.

               sort hv001 hv002 hvidx
               
               save temp.dta, replace
               
               use RWPR70FL.DTA, clear             

               sort hv001 hv002 hvidx
               merge 1:1 hv001 hv002 hvidx using temp.dta
               
               erase temp.dta
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mismatch between reported and generated output on merged file
Next Topic: Couple file from male and female dataset
Goto Forum:
  


Current Time: Sat May 30 01:49:21 Eastern Daylight Time 2020