The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging KR file with PR file India DHS 2019-21 (NFHS-5) (Merging KR file with PR file India DHS 2019-21 (NFHS-5))
Merging KR file with PR file India DHS 2019-21 (NFHS-5) [message #27392] Sat, 05 August 2023 09:40 Go to previous message
preshit is currently offline  preshit
Messages: 13
Registered: March 2018
Location: Tucson, AZ, USA
Member
Hello,
I am attempting to merge the KR file with the PR file for India DHS 2019-21 (NFHS-5) dataset. I am following this post for NFHS-4, assuming it should work with NFHS-5 files as well.

Merging KR and BR data files [message #19180]:https://userforum.dhsprogram.com/index.php?t=msg& ;amp ;th=8882&start=0&

My codes are below:

*************
*For KR file
*************
use caseid v001 v002 b16 v024 v003 v004 using "IAKR7EFL.DTA", clear

keep if b16>0 & b16<. //this will remove children who are not listed in the HH list

rename v024 hv024
rename v001 hv001
rename v002 hv002
rename b16 hvidx
rename v003 hv003
rename v004 hv004

sort hv024 hv001 hv002 hv004 hvidx // hhid hv003

save "NFHS5_KRclean.dta", replace


*************
*For PR file
*************
clear all


use hhid hv001 hv002 hvidx hv003 hv004 hv024 using "IAPR7EFL.DTA", clear


sort hv024 hv001 hv002 hv004 hvidx //hhid hv003

merge m:m hv024 hv001 hv002 hv004 hvidx using "NFHS5_KRclean.dta"


Result # of obs.
-----------------------------------------
not matched 2,621,943
from master 2,621,942 (_merge==1)
from using 1 (_merge==2)

matched 221,982 (_merge==3)
-----------------------------------------

As shown above, the merge did not match one observation from the KR file. I have further looked into the unmatched observation and have found that its b6/hvidx (line no.) from the KR file is not present in the PR file. Can DHS confirm this observation is additional in the KR file? Or is it a data processing error that can be rectified? I would also appreciate any feedback on my merging code if it is correct or if I need to modify it for correct merging.

I will appreciate any help with this.


Regards
Preshit

[Updated on: Sat, 05 August 2023 09:41]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Merging IR and HR files for Bangladesh
Next Topic: Merging children, mother, and father's characteristics
Goto Forum:
  


Current Time: Mon Nov 25 23:53:23 Coordinated Universal Time 2024