The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Combining KR and PR files
Combining KR and PR files [message #10712] Mon, 05 September 2016 09:15 Go to next message
waltine is currently offline  waltine
Messages: 21
Registered: March 2013
Location: South Africa
Member
Dear All,

I am trying to merge the KR and BR files but I keep getting this error message even after following steps in previous "Merge threads".

Error: variables hv001 hv002 hvidx do not uniquely identify observations in the using data.

Syntax:
use "E:\NDHS 2013\ngkr6adt\NGKR6AFL.DTA", clear

. ren v001 hv001

. ren v002 hv002

. ren b16 hvidx

. sort hv001 hv002 hvidx

. save "C:\Users\Somefun\Desktop\Working Papers\Child Health Outcomes\KR.dta", replace
file C:\Users\Somefun\Desktop\Working Papers\Child Health Outcomes\KR.dta saved

. use "E:\NDHS 2013\ngpr6adt\NGPR6AFL.DTA", clear

. sort hv001 hv002 hvidx

. merge 1:1 hv001 hv002 hvidx using "C:\Users\Somefun\Desktop\Working Papers\Child Health Outcomes\KR.dta"
variables hv001 hv002 hvidx do not uniquely identify observations in the using data
r(459);


Thank you.


waltine
Re: Combining KR and PR files [message #10718 is a reply to message #10712] Tue, 06 September 2016 08:07 Go to previous messageGo to next message
waltine is currently offline  waltine
Messages: 21
Registered: March 2013
Location: South Africa
Member
I am using the Nigerian 2013 dataset

waltine
Re: Combining KR and PR files [message #10719 is a reply to message #10718] Tue, 06 September 2016 09:37 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3214
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

After your first line ("use...., clear") you need to insert this line: "drop if b16==0 | b16==." . The KR and BR files include children who have died or who are not living with the mother, and for them b16 will be "0" or "." . There may be more than one such child with a specific combination of v001 and v002. Otherwise you are ok.
Previous Topic: Merging datasets of different rounds- longitudinal
Next Topic: Merging Men, Women, Child dataset into Household level unit analysis
Goto Forum:
  


Current Time: Sun Dec 22 10:05:02 Coordinated Universal Time 2024