Re: Variable v034: merging datasets [message #24911 is a reply to message #24887] |
Mon, 01 August 2022 12:33 |
Janet-DHS
Messages: 911 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
I believe you want to identify men in the PR file who are de jure (hv102=1) but absent (hv103=0) and whose line number is given in the IR file by v034. I will illustrate with the Nigeria 2018 survey (NG7B). It shows that out of 25,662 husbands identified in the PR file, there were 687 who were de jure but not de facto. Hope this is what you were looking for.
cd e:\DHS\DHS_data\scratch
use "...NGIR7BFL.DTA", clear
keep v001 v002 v003 v034
rename v001 cluster
rename v002 hh
rename v003 wline
rename v034 hline
sort cluster hh hline
save NGIRtemp.dta, replace
* w for wife, h for husband
use "...NGPR7BFL.DTA", clear
* keep males age 15+
keep if hv104==1 & hv105>=15
keep hv001 hv002 hvidx hv102 hv103
rename hv001 cluster
rename hv002 hh
rename hvidx hline
sort cluster hh hline
tab hv102 hv103
merge cluster hh hline using NGIRtemp.dta
tab _merge
tab hv102 hv103 if _merge==3
. tab hv102 hv103 if _merge==3
usual | slept last night
resident | no yes | Total
-----------+----------------------+----------
no | 0 31 | 31
yes | 687 24,944 | 25,631
-----------+----------------------+----------
Total | 687 24,975 | 25,662
|
|
|