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
Merge PR and KR in wave 3, b16 does not exist [message #14951] Sat, 19 May 2018 12:59 Go to next message
nibiti is currently offline  nibiti
Messages: 20
Registered: April 2018
Location: Göttingen
Member
Hi all,

I am trying to merge PR with KR datasets for Sub-Saharan Africa, using PR as the base file. I have encountered a problem that many seem to have faced in this forum. My Stata tells me that my "variables hv001 hv002 and hvidx do not uniquely identify the observations in the using data".

Now, I have tried to find an answer in other forum threads (like this one: https://userforum.dhsprogram.com/index.php?t=msg&goto=28 46&) and the suggested answer seems to use b16 as identifier instead.

However, I face two problems:

1. b16 seems to not have been part of wave 3 and is not included in any of the wave 3 datasets. Is there a way in which I can still merge PR and KR datasets for wave 3? What identifier should be used instead?

Edit: I found my own answer here: https://userforum.dhsprogram.com/index.php?t=msg&th=1900 &goto=10942&S=Google where it says that wave 3 is indeed not available.


2. For wave 4 to 7 I still receive the same error message again. That my variables (hv001/v001, hv002/v002, hvidx/b16) do not uniquely identify my observations.

Edit: I also tried dropping b16 for values of 0 or 99, but the error message remains.

Many thanks in advance!

Best regards
Timo

[Updated on: Sat, 19 May 2018 13:37]

Report message to a moderator

Re: Merge PR and KR in wave 3, b16 does not exist [message #14958 is a reply to message #14951] Mon, 21 May 2018 12:58 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1621
Registered: February 2013
Senior Member

Following is a response from Senior DHS Stata Specialist, Tom Pullum:

For the early surveys that do not include b16, there is no foolproof way to merge the PR and KR files. You can come close, using the sex and age of the child, but this will not always work, because there are genuine matches in which the age of the child is different in the two files.

Users may be able to suggest something but within DHS we have not found a reliable way to do this.
Re: Merge PR and KR in wave 3, b16 does not exist [message #14961 is a reply to message #14958] Tue, 22 May 2018 08:28 Go to previous messageGo to next message
nibiti is currently offline  nibiti
Messages: 20
Registered: April 2018
Location: Göttingen
Member
Hi Tom,

thanks for your reply. I have dropped the KR wave 3 data now.


But do you also have an answer for my second question? hv001/v001, hv002/v002 and hvidx/b16 do not uniquely identify the data in wave 4 and in wave 6, independent of the country (I am using all Sub-Saharan African countries).

I am using the exact same code for wave 5 and there the merge works fine. But for wave 4 and wave 6 it does not seem to work. My code broadly looks like this:

In KR file:
rename v001 hv001
rename v002 hv002
rename b16 hvidx

In PR file:
sort hv001 hv002 hvidx
merge 1:1 hv001 hv002 hvidx using "KR.dta"

This leads to the following error message:

"variables hv001 hv002 hvidx do not uniquely
identify observations in the using data
r(459);"


Any ideas?

Best
Timo
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 next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1621
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
Re: Merge PR and KR in wave 3, b16 does not exist [message #15379 is a reply to message #14951] Sun, 08 July 2018 23:16 Go to previous message
kingx025 is currently offline  kingx025
Messages: 93
Registered: August 2016
Location: Minneapolis. Minnesota
Senior Member
I'm not sure what data you need to secure by merging the PR and KR observations. If you need some background characteristics about the households, such as type of toilet facility, source of drinking water, etc. as well as the child data, an alternative approach may be to go to IPUMS-DHS (www.idhsdata.org), choose children as your unit of analysis (data from the KR file), and select additional variables relating to the mother's or household characteristics. We have merged the household file (HR) to the mother's (IR) files, and merged both to children's records (and birth records). Thus, if you create a customized dataset using IPUMS-DHS and children as the unit of analysis, you can add any characteristics related to the child's mother (including some not included in the original KR files, such as experience of domestic violence) and summary variables about the mother's household, such as type of toilet facility, source of water, wealth index, housing characteristics, agricultural and non-agricultural possessions, anti-malarial measures, nutritional indicators (such as iodized salt), and summary geography indicators.

The linking problems referred to in other messages in this thread did not affect our linking households to women (HR to IR) and linking women/mothers to children (IR to KR), so the approach described above may be a more general as well as a less labor-intensive solution.

Miriam King


Dr. Miriam King
IPUMS-DHS Project Manager (www.idhsdata.org)
Previous Topic: merging HW ans KR data for 1994 zimbabwe
Next Topic: Merging HW to IR for Mali DHS IV - Missing HWCASEID
Goto Forum:
  


Current Time: Fri May 24 01:51:32 Eastern Daylight Time 2019