The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging KR with PR for Ethiopia 2011
Merging KR with PR for Ethiopia 2011 [message #14997] Thu, 24 May 2018 10:56 Go to next message
Yue_Chen
Messages: 2
Registered: May 2018
Location: Washington D.C.
Member
Dear DHS Experts,

I am trying to replicate Table 10.7 Prevalence of diarrhoea in Ethiopia's 2011 report. However, I am having troubles merging PR dataset with KR. I have tried different ways but none of them works. I copied my codes as below.

use "/Ethiopia/2011/ETPR61DT/ETPR61FL.DTA", clear
keep hv001 hv002 hvidx hv201 hv205 hv225
rename hv001 v001
rename hv002 v002
rename hvidx b16
sort v001 v002 b16
save "/Ethiopia/2011/ETKR61DT/ETkKR61FLdiarrhoea.dta", replace

use "/Ethiopia/2011/ETKR61DT/ETKR61FL.DTA", clear
keep v001 v002 b16 v005 v008 b3 b5 h11 h11b v024 v025
sort v001 v002 b16
merge v001 v002 b16 using "/Ethiopia/2011/ETPR61DT/ETPR61FLdiarrhoea.dta"

Stata reports that the variables don't uniquely identify observations. If that's the case, which variables should I use instead? Thanks in advance!




Yue Chen
Re: Merging KR with PR for Ethiopia 2011 [message #15193 is a reply to message #14997] Thu, 14 June 2018 12:02 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 1580
Registered: February 2013
Senior Member
Please reference the response to a similar post: 15192

Re: Merging KR with PR for Ethiopia 2011 [message #15378 is a reply to message #14997] Sun, 08 July 2018 23:04 Go to previous messageGo to next message
kingx025 is currently offline  kingx025
Messages: 91
Registered: August 2016
Location: Minneapolis. Minnesota
Senior Member
If I am understanding correctly, you want to merge the KR and PR files for Ethiopia 2011 to replicate the categories in Table 10.7 of the final report, with information on diarrhea from the KR files and household characteristics taken from the PR files. A simpler approach, in my opinion, is simply to merge the household record for the child's mother to the KR file. IPUMS-DHS has already done this for you; for the KR (child) and BR (birth) files, we have merged the mother's record from the IR file and the mother's household record. Thus, you can get all the variables you need if you choose "children" as your unit of analysis and select the following variables in IPUMS-DHS:

Child's age in months: HW1 (KIDAGEMO) https://www.idhsdata.org/idhs-action/variables/KIDAGEMO#code s_section
Child's sex: B4 (KIDSEX) https://www.idhsdata.org/idhs-action/variables/KIDSEX#codes_ section
HH source of drinking water: HV201 (DRINKWTR): https://www.idhsdata.org/idhs-action/variables/DRINKWTR#code s_section
Type of HH toilet facility: HV205 (TOILETTYPE): https://www.idhsdata.org/idhs-action/variables/TOILETTYPE#co des_section
Toilet facility shared: HV225 (TOILETSHAREYN); https://www.idhsdata.org/idhs-action/variables/TOILETSHAREYN #codes_section
Urban-rural residence: V025 (Urban) https://www.idhsdata.org/idhs-action/variables/URBAN#codes_s ection
Region of residence: V101_ET2011 (GEO_ET2011): https://www.idhsdata.org/idhs-action/variables/GEO_ET2011#co des_section
Mother's education: V106 (EDUCLVL): https://www.idhsdata.org/idhs-action/variables/EDUCLVL#codes _section
Household wealth quintile: V190 (WEALTHQ): https://www.idhsdata.org/idhs-action/variables/WEALTHQ#codes _section
Child had recent diarrhea: H11 (DIARRECENT): https://www.idhsdata.org/idhs-action/variables/DIARRECENT#co des_section
Blood in child's stools: H11B (DIABLOODST) https://www.idhsdata.org/idhs-action/variables/DIABLOODST#co des_section
Weight: V005 (PERWEIGHT) https://www.idhsdata.org/idhs-action/variables/PERWEIGHT#cod es_section

When you merge the PR and KR data, you have to drop the cases of children not included in the KR file, anyway. The only possible problem that I see is that some of the background variables (on urban residence, region of residence, and wealth quintiles) use the variable from the IR file, rather than the variable from the linked household file, so you may get some results with "non-resident" as a code in your results, which are not in the table. We're planning on adding the household-based version of those variables to the IPUMS-DHS data for women, children, and births by Fall.

You can make a customized data file from IPUMS-DHS (www.idhsdata.org) by logging in with your DHS user name and password, selecting the above variables and ET2011 as a sample for a customized dataset, selecting your preferred data format, and downloading the customized (free) data file to your computer for analysis. You will have to do some recoding of the variable on type of toilet facility, but that would be the case with the original DHS files as well.

I hope this helps.

Miriam King


Dr. Miriam King
IPUMS-DHS Project Manager (www.idhsdata.org)
Re: Merging KR with PR for Malawi 2015-16 [message #17437 is a reply to message #14997] Mon, 18 March 2019 08:26 Go to previous message
Felixo is currently offline  Felixo
Messages: 1
Registered: March 2019
Member
Dear Expert,
I am working on children malnutrition using Mdhs dataset.
I have been able to merge KR with PR files using PR file as the base file.
This is achieved by
1. convert variables v001, v002 and B16 to HV001, HV002 and HVIDX respectively, in the KR file.
2. sort cases using the key identifier variables HV001, HV002 and HVIDX
3. open the PR file and sort by HV001, HV002 and HVIDX
4. select cases based on HVIDX>=2 & HVIDX<=17 & HV103=1 & 0<=HC1<=59
5. Compute weight variable using HV005/1000000; and weigh the reduced dataset PR

With the above, I could obtain the prevalence of the stunting (37.1%), wasting (2.7%) and underweight (11.5%) as it were in the Malawi DHS report.
However, the sample size increases by 20 (from 6,033 to 6,053). Please advise appropriately on what I could do next to avoid this increase.
Thank you for your prompt intervention.
Previous Topic: merging MWIR7IDT.DTA with Variable hml19
Next Topic: Merging Women-Men-HIV Data: Different Countries, Different Years
Goto Forum:
  


Current Time: Mon Mar 18 10:23:44 Eastern Daylight Time 2019