The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » STATA codes to merge women and household datasets
Re: STATA codes to merge women and household datasets [message #17989 is a reply to message #13961] Sun, 11 August 2019 08:48 Go to previous messageGo to previous message
Isabelle is currently offline  Isabelle
Messages: 2
Registered: July 2019
Member
Hello Mrinal and the community,

I am working with the NFHS-2 and I am trying to merge the datasets "household" and "individual" exactly like you described earlier. I used the same code, however, I am not able to merge the datasets as
"variables v001 v002 v003 do not uniquely identify observations in the master data".

I added the commands I used. I cannot identify what I am doing wrong, so I am thankful for any advice.
___________

use "C:\Users\Isabelle\Desktop\DHS Data India\1998-99\Household\IAHR42FL.dta" // household dataset
gen int v001 = hv001
gen int v002 = hv002
gen byte v003 = hv003
sort v001 v002 v003
save "C:\Users\Isabelle\Desktop\DHS Data India\Single Datasets Recode\1998-99Recode\1998-99HouseholdSort.dta", replace

use "C:\Users\Isabelle\Desktop\DHS Data India\1998-99\Individual\IAIR42FL" //women dataset
sort v001 v002 v003
merge 1:m v001 v002 v003 using "C:\Users\Isabelle\Desktop\DHS Data India\Single Datasets Recode\1998-99Recode\1998-99HouseholdSort.dta"

save "C:\Users\Isabelle\Desktop\DHS Data India\Single Datasets Recode\1998-99Recode\1998-99RecMerge.dta"
___________

Kind regards,
Isabelle
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SPA 2012-2017 Senegal
Next Topic: sample weights in women file
Goto Forum:
  


Current Time: Thu Apr 25 11:29:49 Coordinated Universal Time 2024