The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Kenya » Merging IR and MR Kenya 2022 (2022 KDHS) (Chronic Disease)
Re: Merging IR and MR Kenya 2022 (2022 KDHS) [message #28358 is a reply to message #28357] Wed, 20 December 2023 01:05 Go to previous messageGo to previous message
sokiya is currently offline  sokiya
Messages: 76
Registered: May 2017
Location: Nairobi
Senior Member
I would use the following code with an assumption that the variables in IR and MR are similar with an exception of the m prefix in the MR file

*mens recode
use "KEMR8BFL", replace
* Drop variables that will cause problems in renaming. You can handle them better!
drop m304a*
* Remove m prefix
renpfix m

tempfile MRtemp
save `MRtemp'


*individual recode
*use "KEIR8BFL", clear
* Generate gender variable
gen gender = 2
append using `MRtemp'
replace gender = 1 if mi(gender)
lab def gender 1 "Male" 2 "Female"
lab val gender gender
ta gender

Let me know in case of further questions
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: KDHS 2022: Table 5.10 Age at first birth
Next Topic: Knowing the exact date of interview
Goto Forum:
  


Current Time: Mon Aug 5 19:12:31 Coordinated Universal Time 2024