Re: Merging DHS Pakistan 2017-2018 [message #30372 is a reply to message #30370] |
Fri, 15 November 2024 17:27   |
Bridgette-DHS
Messages: 3230 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Tom Pullum:
Your merge worked correctly. I did it a little differently and got the same result (see below).
The PR file includes all household members, including males of all ages and females who are not eligible for the women's interview. When I do this merge I first reduce the PR file to household members who are eligible for the women's interview. These are the cases with hv117=1.
By the way, the lines you gave were incomplete. You did not include the "merge" command. Also your first "save" line has the same filename as the file in the first "use" line. That command would over-write the first file, something to be avoided at all costs and something I'm pretty sure you did not do. Anyway, your merge did work correctly.
* Specify workspace
cd e:\DHS\DHS_data\scratch
use "...PKPR71FL.DTA", clear
* Reduce to women who are eligible for the IR file
keep if hv117==1
gen cluster=hv001
gen hh=hv002
gen line=hvidx
save temp.dta, replace
use "...PKIR71FL.DTA", clear
gen cluster=v001
gen hh=v002
gen line=v003
merge 1:1 cluster hh line using temp.dta
tab _merge
* women with _merge=2 were eligible but not interviewed; they count as nonresponse cases
keep if _merge==3
drop _merge
* Save the merged file with a different name
[Updated on: Fri, 15 November 2024 17:28] Report message to a moderator
|
|
|