The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging HR and IR
merging HR and IR [message #13838] Wed, 10 January 2018 03:02 Go to next message
pipitherawati03@gmail.com is currently offline  pipitherawati03@gmail.com
Messages: 4
Registered: April 2017
Location: Bandung-West Java- Indone...
Member
Dear DHS

sorry, i want to analyze about sosio economic factors(head household study attainment, wealth index, women/spouse study attainment etc) and exposure tobacco smoke in household in Indonesia (analyze from Indonesia DHS 2012). Then, i merge IR file as based and HR file, but i the result show that theres 55.093 cases, meanwhile cases in female fil is 45.607 and cases in HR are 43.852.
so,
1. is it right, that i merge IR and HR, where IR is based. but my unit analysis is household?
2. why it 55.093 cases? not 43.852 likes household cases? and why i can get the right way.

thank you so much for your advance


Pipit
Re: merging HR and IR [message #13843 is a reply to message #13838] Thu, 11 January 2018 08:18 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3013
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

In every survey, there are some households that have no eligible women. Those will show up as cases in the merged file for which the diagnostic variable "_merge" is different from 3. If you drop such cases, you will get as many cases as there are in the IR file. I have written lines for this kind of merge that will attach the education of the household head to the woman, and also the household-level smoking variable hv252. The wealth quintile is already in the IR file. (It is v190 in the IR file and hv270 in the HR file.)

You will have to change the paths and you will not want to reduce the variables the way I have done. Let me know if you have questions.

set more off
use e:\DHS\DHS_data\HR_files\IDHR63FL.dta, clear 
keep hv001 hv002 hv252 hv101* hv106*
rename hv101_0* hv101_*
rename hv106_0* hv106_*

* Identify the household head and the education of the household head
* Note: It appears that in this survey the household head is always on line 1
*   but in many surveys there are some exceptions to this
gen hvidx_hhhead=.
gen ed_hhhead=.

local li=1
while `li'<=31 {
replace hvidx_hhhead=`li'    if hv101_`li'==1
replace ed_hhhead=hv106_`li' if hv101_`li'==1
local li=`li'+1
}

keep hv001 hv002 hv252 *head
rename hv001 v001
rename hv002 v002
sort v001 v002
save e:\DHS\DHS_data\scratch\temp.dta, replace

use e:\DHS\DHS_data\IR_files\IDIR63FL.dta, clear
keep v001 v002 v003 v106 v190 v191
sort v001 v002 v003

merge v001 v002 using e:\DHS\DHS_data\scratch\temp.dta

tab hvidx _merge

* drop cases in the merge for households with no woman in the IR file
drop if _merge~=3
drop _merge

* It may be helpful to know when the woman is in fact the household head
gen woman_is_hhhead=0
replace woman_is_hhhead=1 if hvidx_hhhead==v003

Re: merging HR and IR [message #13848 is a reply to message #13843] Thu, 11 January 2018 20:39 Go to previous messageGo to next message
pipitherawati03@gmail.com is currently offline  pipitherawati03@gmail.com
Messages: 4
Registered: April 2017
Location: Bandung-West Java- Indone...
Member
Thank you so much for your command.
But im very sory, i forgot tell that i use spss. Could you give me the step for spss


Pipit
Re: merging HR and IR [message #13849 is a reply to message #13848] Fri, 12 January 2018 00:00 Go to previous message
pipitherawati03@gmail.com is currently offline  pipitherawati03@gmail.com
Messages: 4
Registered: April 2017
Location: Bandung-West Java- Indone...
Member
once again im sorry Mr/Mrs...

i would like to analyze about the existence of a or some child's age <18 years old. thank you so much


Pipit
Previous Topic: Merging PR file with KR file
Next Topic: Issue merging household and individual (women's) file
Goto Forum:
  


Current Time: Tue Mar 19 06:20:15 Coordinated Universal Time 2024