The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Nepal » Merge IR and MR file DHS 2022 Nepal (Mental Health )
Re: Merge IR and MR file DHS 2022 Nepal [message #27887 is a reply to message #27868] Tue, 17 October 2023 12:28 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 893
Registered: April 2022
Senior Member
Following is a response from DHS staff member, Tom Pullum:

I believe you want to append, rather than merge. In an append the women and men in the IR and MR files will remain as individuals on separate records. The following Stata lines will construct the file. You need to change the paths and the working folder and decide what covariates (besides v0*) to include. The "sex" variable is constructed in the same way as hv104 in the PR file.

If what you want is a pairing of women and men into couples, you would use the CR file, which is one of the standard recode files. In that file, the mth variables refer to the woman and the mmth variables refer to the man. The CR file only includes women and men who name each other as partners.

* Nepal 2022 DHS
* Construct a file with the mental health variables for all women and men
* Keep the needed covariates; illustrated here with just the v0* variables

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

use "...NPIR82FL.DTA", clear
keep v0* mth*
gen sex=2
save NPtemp.dta, replace

use "...NPIR82FL.DTA", clear
rename m* *
keep v0* mth*
gen sex=1
append using NPtemp.dta
sort v001 v002 v003
label define sex 1 "Male" 2 "Female"
label values sex sex

* Sort here is optional
sort v001 v002 v003

* save this file with a new name
 
Read Message
Read Message
Previous Topic: Road traffic accident
Next Topic: Intimate partner violence against women
Goto Forum:
  


Current Time: Sun Dec 1 14:44:58 Coordinated Universal Time 2024