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)
IR + MR or CR + IR [message #24794] Tue, 12 July 2022 06:24 Go to next message
AJM is currently offline  AJM
Messages: 1
Registered: July 2022
Location: Germany
Member
Good day,
I hope to find you well.

I wanted to ask for some recommendations and help;
I am interested to know if parents from certain characteristics plan the pregnancies to fit or avoid certain events.

My idea is to;
1. Merge either
a) IR with MR, or
b) CR with IR
--> CR only contains couples, but I would also like to have single mothers or women whose husbands/partners are not in the dataset.
Questions: what would you suggest to merge?
If: a) Do you have a code for STATA to merge IR and MR to create couples and keep women without? (Guide to DHS Statistics recommends using CR, so there is no more info. on how to merge IR and MR)
If: b) Could you help me with my STATA code to do the CR and IR merge (see attached file) to avoid duplicates, please?

2. The resulting merge, add the wealth index from HR
For this I have not started the coding.

Thank you very much for your help and time.
Regards,
AJM
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: 888
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.
Previous Topic: Merge Other Biomarkers with HH
Next Topic: Merging household level data set with men and women dataset
Goto Forum:
  


Current Time: Tue Nov 26 06:32:22 Coordinated Universal Time 2024