The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging IR and PR - Indonesia 1987
Re: Merging IR and PR - Indonesia 1987 [message #27988 is a reply to message #27982] Tue, 31 October 2023 10:27 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3189
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

Many examples of merges have been given on the forum. At the end of this post I will paste the lines that I would normally use to do this kind of merge. I would reshape the HR file, to construct the equivalent to a PR file, then reduce the PR file to women (perhaps to women age 15-49) and then merge using the cluster ID, household ID, and line number. Unfortunately, in this HH file I cannot identify the cluster ID and household ID (the line number is hhlno). There are only a few unsubscripted variables in the HH file. I suspect that the ID variables have something to do with the three "*samp*" variables but I can't figure it out.

I don't think the approach you are using, without ID codes, will be reliable. For one thing, age in the household survey and age in the women's survey may not be exactly the same. There can be other inconsistencies that will result in ambiguous matches.

This is an interesting challenge, but the Indonesia 1987 DHS is one of our oldest surveys and we can't provide more support for it.

* Specify a workspace
cd e:\DHS\DHS_data\scratch

use "...IDHH01FL.DTA", clear
* must find the cluster id and household id

gen cluster=?hhnisamp
gen hh=?

rename *_0* *_*
keep cluster hh hhsex* hhage*

reshape long hhsex_ hhage_ .... ,i(cluster hh) j(line)
rename *_ *
keep if hhsex==2
sort cluster hh line
save ID01temp.dta, replace 

use "...IDIR01FL.DTA", clear
gen cluster=v001
gen hh=v002
gen line=v003
sort cluster hh line
merge 1:1 cluster hh line using ID01temp.dta

tab _merge
keep if _merge==3
drop _merge
 
Read Message
Read Message
Previous Topic: weighting of men's data in Nepal DHS 2022 survey
Next Topic: Merging two rounds
Goto Forum:
  


Current Time: Thu Nov 7 17:30:06 Coordinated Universal Time 2024