The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merge NFHS 4 recode files
Merge NFHS 4 recode files [message #18155] Tue, 01 October 2019 01:01 Go to next message
marian is currently offline  marian
Messages: 13
Registered: August 2019
Member
Hi,

I wanted to conduct state and district wise analysis ( correlation and tabulation) of child's nutritional status with their birth weight/size, mothers schooling and mothers BMI. (Hence merge PR with IR, KR files)

I also wanted to check consumption of food groups across household wealth index (Hence KR merged with HR) and cross tabulate child and mothers food group consumption (merge KR and IR )

Please help me with doing this on stata for NFHS 4 file.
Re: Merge NFHS 4 recode files [message #18158 is a reply to message #18155] Tue, 01 October 2019 07:28 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3038
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

There have been many postings, including Stata code, for such merges. The only thing that is special about the NFHS-4 (and this is also specified in earlier postings) is that region (v024 or hv024) must be included as part of the case ID.
Re: Merge NFHS 4 recode files [message #18174 is a reply to message #18158] Fri, 04 October 2019 00:11 Go to previous message
marian is currently offline  marian
Messages: 13
Registered: August 2019
Member
Dear Mam,

I have tried to use the following code for merging the three datasets. The error message at end of merge command used is "variables hv024 hv001 hv002 hvidx shv005 shdistri hv021 hv022 hv023 do not uniquely identify observations in the using data". Please help.. I am using Stata 15




use caseid v001 v002 v003 v005 sv005 v024 sdistri v013 v042 v445 v457 v208 v213 v008 b3_01 v021 v022 v023 using "C:\Users\NOUSE\Documents\NFHS_Other\Duplicate\IAIR74FL.DTA", clear
rename v001 hv001
rename v002 hv002
rename v003 hvidx
rename v024 hv024
rename v021 hv021
rename v022 hv022
rename v023 hv023
rename sv005 shv005
rename sdistri shdistri

save C:\Users\NOUSE\Desktop\Merged\IRmerge.dta, replace


use caseid b3 v001 v002 v003 v005 v008 v005 sv005 v013 v024 v021 v022 v023 sdistri m18 m19 using "C:\Users\NOUSE\Documents\NFHS_Other\Duplicate\IAKR74FL.DTA", clear
rename v001 hv001
rename v002 hv002
rename v003 hvidx
rename v024 hv024
rename sv005 shv005
rename sdistri shdistri
rename v021 hv021
rename v022 hv022
rename v023 hv023

append using C:\Users\NOUSE\Desktop\Merged\IRmerge.dta

sort hv001 hv002 hvidx hv024 shv005 shdistri hv021 hv022 hv023
save C:\Users\NOUSE\Desktop\Merged\IRKRPRmerge.dta, replace


use hhid hv001 hv002 hv024 shv005 shdistri hv021 hv022 hv023 hvidx hv103 hc1 hc57 hc70 hc71 hc72 hv042 using "C:\Users\NOUSE\Documents\NFHS_Other\Duplicate\IAPR74FL.DTA", clear
sort hv024 hv001 hv002 hvidx shv005 shdistri hv021 hv022 hv023

merge m:1 hv024 hv001 hv002 hvidx shv005 shdistri hv021 hv022 hv023 using C:\Users\NOUSE\Desktop\Merged\IRKRPRmerge.dta

assert _merge==1 | _merge==3
keep if _merge==3

[Updated on: Fri, 04 October 2019 00:12]

Report message to a moderator

Previous Topic: Merging MR and HR and analyzing a variable from HR
Next Topic: MERGING PR and IR data
Goto Forum:
  


Current Time: Tue Apr 23 14:25:30 Coordinated Universal Time 2024