The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Extracting data from HH (Partner/Husband Education from HH file)
Extracting data from HH [message #24631] Fri, 10 June 2022 02:21 Go to next message
mrriips is currently offline  mrriips
Messages: 2
Registered: August 2019
Location: Mumbai, India
Member
Hi,

I was extracting husband/partner educational attainment from the HH file [IAHR7AFL] to match with women's file [IAIR7AFL] and using below code because women file have missing cases for their partner/husband education.

gen hus_edu = .
forval o = 1/9 {
forval k = 2/9 {
replace hus_edu = hv108_0`o' if hv101_0`k' == 2 & hv104_0`k' == 2
}
}
.

forval o = 10/35 {
forval k = 11/35 {
replace hus_edu = hv108_`o' if hv101_`k' == 2 & hv104_`k' == 2
}
}
.
ta hus_edu

Please suggest.

Thanks in advance
Mukesh Ravi Raushan


Re: Extracting data from HH [message #24642 is a reply to message #24631] Mon, 13 June 2022 11:06 Go to previous messageGo to next message
Janet-DHS is currently offline  Janet-DHS
Messages: 162
Registered: April 2022
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

You are correct that in this survey, husband's education (v701) is missing for most (about 80%) of the women who are currently married. There is no good reason for that. Your strategy is to match women with their husbands using the relation to head code (hv101) in the HR file. You will indeed capture the great majority of women and husbands from the head / spouse pairs but not all of them. The following Stata code, using the PR file (rather than the AR file) will produce a file of women who can be merged with the IR file. Note that in the India surveys, state (hv024 or v024) is part of the unique identifier.


use "...IAPR7AFL.DTA" , clear

keep hv001 hv002 hv024 hvidx hv101 hv104 hv108

keep if hv101==1 | hv101==2

gen hv101_1=0
gen hv101_2=0

gen head=1 if hv101==1
gen head_sex=hv104 if head==1
gen head_ed=hv108 if head==1
gen head_line=hvidx if head==1

gen spouse=1 if hv101==2
gen spouse_sex=hv104 if spouse==1
gen spouse_ed=hv108 if spouse==1
gen spouse_line=hvidx if spouse==1

collapse (min) head* spouse*, by(hv001 hv002 hv024)
drop if spouse==.

rename hv001 v001
rename hv002 v002
rename hv024 v024

* combinations in which the woman is spouse and the man is head
gen v003=spouse_line if spouse_sex==2
gen woman_ed=spouse_ed if spouse_sex==2
gen husband_ed=head_ed if spouse_sex==2

* combinations in which the woman is head and the man is spouse
replace v003=head_line if head_sex==2
replace woman_ed=head_ed if head_sex==2
replace husband_ed=spouse_ed if head_sex==2

drop head* spouse*

* prepare the file for a merge with the IR file
order v024 v001 v002 v003 woman_ed husband_ed

list if _n<=50, table clean
sort v024 v001 v002 v003

* save and then merge with the sorted IR file
Re: Extracting data from HH [message #24659 is a reply to message #24642] Thu, 16 June 2022 01:11 Go to previous message
mrriips is currently offline  mrriips
Messages: 2
Registered: August 2019
Location: Mumbai, India
Member
Thank you. This is helpful.
Previous Topic: BDHS 2014 : Calculating level weights
Next Topic: Multiple Sexual Partner in Husband
Goto Forum:
  


Current Time: Sun Aug 14 14:03:28 Coordinated Universal Time 2022