The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » IR + MR or CR + IR (suggestions on datasets merge)
Re: IR + MR or CR + IR [message #24798 is a reply to message #24794] Wed, 13 July 2022 08:58 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 809
Registered: April 2022
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

You say this: "CR only contains couples, but I would also like to have single mothers or women whose husbands/partners are not in the dataset."

The IR file includes all women, so you seem to be looking for the women who are in the IR file but not in the CR file. You are using ID42, the Indonesia 2002-03 survey. Here is Stata code to identify such women (you need a location for a temporary CR file):

use v001 v002 v003 using"...IDCR42FL.DTA", clear
sort v001 v002 v003
save e:\DHS\DHS_data\scratch\IDCR42temp.dta, replace


use "...IDIR42FL.DTA", clear
sort v001 v002 v003
merge v001 v002 v003 using e:\DHS\DHS_data\scratch\IDCR42temp.dta

tab _merge


Here is the distribution of _merge:

_merge | Freq. Percent Cum.
------------+-----------------------------------
1 | 21,799 73.94 73.94
3 | 7,684 26.06 100.00
------------+-----------------------------------
Total | 29,483 100.00


The women you are looking for are those with _merge=1.

There aren't any duplicated women in this file but you could identify and drop duplicates with these lines:

sort v001 v002 v003
egen sequence=seq(), by(v001 v002 v003)
tab sequence
keep if sequence==1
drop sequence

You cannot "merge" the IR and MR files for any women and men other than the couples who identify each other with v034 and mv034* and are in the couples file. There is no other basis for matching women and men.
 
Read Message
Read Message
Previous Topic: Merge Other Biomarkers with HH
Next Topic: Merging household level data set with men and women dataset
Goto Forum:
  


Current Time: Fri Aug 30 12:22:22 Coordinated Universal Time 2024