Merging IR and MR Kenya 2022 (2022 KDHS) [message #28346] |
Mon, 18 December 2023 16:04 |
bakerchowdhury
Messages: 25 Registered: April 2014
|
Member |
|
|
Hello everyone,
I am analyzing 2022 Kenya DHS. To do all women and men as unit of analysis I would like to add the women (IR) and men's (MR) data together. The IR file has straightforward DHS variable names, however; the MR files has an 'm' added in the beginning of each variables.
I have used the below Stata code.
*mens recode
use "KEMR8BFL", replace
rename (mv001 mv002 mv003 mv005) (v001 v002 v003 v005)
sort v001 v002 v003
save "MRtemp.dta", replace
*individual recode
use "KEIR8BFL", clear
sort v001 v002 v003
merge v001 v002 v003 using "MRtemp.dta"
However, this code doesn't combine the data appropriately. What would be best approach to keep same variable names for both men and women by creating a sex variable and use survey weights appropriately?
The goal is to analyze the chronic disease indicators (chapter 14) primarily by gender and other characteristics. Although I have successfully replicated the Chapter 14 tables separately by sex, I am facing difficulty in consolidating them into one data file so that I can achieve my analysis goal.
I would greatly appreciate your insights and recommendations on the most efficient approach to address this issue.
Thank you for your time and assistance.
Best regards,
Thank you!
Muhammad
|
|
|
|
|
|
Re: Merging IR and MR Kenya 2022 (2022 KDHS) [message #28360 is a reply to message #28358] |
Wed, 20 December 2023 13:00 |
Bridgette-DHS
Messages: 3196 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Tom Pullum:
This is not a case-by-case merge. You need to "append" the files. The following Stata lines should work, although you may have to modify them somewhat. For example, in this survey the DV variables for women have the prefix "d", but the DV variables for men have the prefix "sdm" rather than "md", so I include a special line for them. It is possible that other variables need special re-naming.
use "KEMR8BFL", clear
gen sex=1
rename m* *
rename sdm* d*
append using "KEIR8BFL"
replace sex=2 if sex==.
label define sex 1 "Men" 2 "Women"
label values sex sex
|
|
|