The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging IR file with KR (Csection )
Re: merging IR file with KR [message #16821 is a reply to message #16820] Thu, 07 March 2019 02:36 Go to previous messageGo to previous message
Mlue
Messages: 87
Registered: February 2017
Location: Cape Town
Senior Member
Hello Mamadou,

This is how I calculated the c-section births. I did not use the IR file, but instead used the BR file

FOR C-SECTION

clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "..."
use "MWBR7HFL", clear
set more off

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

** WEIGHT VARIABLE
gen weight = v005/1000000

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

** SURVEY SET
gen psu =    v021
gen strata = v022
svyset psu [pw = weight], strata(strata)

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

// RENAME

rename v013 age
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

** SKILLED BIRTH ATTENDANT
gen skilled_birth	=	0
label define skilled_birth 0"Unskilled" 1"Skilled"
label var skilled_birth "Birth delivered by skilled birth attendant"
label val skilled_birth skilled_birth

foreach xvar of varlist m3a m3b {
replace skilled_birth=1 if `xvar'==1
}
*

** PLACE OF DELIVERY
recode m15 (21/26 = 0 "Public sector") (31/36 = 1 "Private sector") ///
(11/12=2 "Home") (96=3 "Other") ///
(99=4 "Missing"), gen(delivery_place)
label var delivery_place "Place of delivery"
label val delivery_place delivery_place

** FACILITY DELIVERY
cap drop facility_delivery
recode delivery_place (0/1 = 1 "Facility births") (else=0 "Non-facility births"), gen(facility_delivery)
label var facility_delivery "Percentage delivered in a health facility"
label val facility_delivery facility_delivery

** CAESAREAN BIRTHS
recode m17 (1 = 1 "C-section") (else = 0 "Not c-section") , gen(c_section)
label var c_section " Birth delivered by C-section"
label val c_section c_section

** DECIDED BEFORE PAINS
recode m17a (1=1 "Yes") (else=0 "No"), gen(decided_before)
label var decided_before "Timing of decision to conduct C-section: Decided before onset of labour pains"
label val decided_before decided_before

** DECIDED AFTER PAINS
cap drop decided_after
recode m17a (2=1 "Yes") (else=0 "No"), gen(decided_after)
label var decided_after "Timing of decision to conduct C-section: Decided after onset of labour pains"
label val decided_after decided_after

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

** DROP IF NOT WITHIN SAMPLE
keep if m15 !=.

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

** CHECK
svy: tab wealth c_section, percent format(%9.1f) row
svy: tab wealth decided_before, percent format(%9.1f) row
svy: tab wealth decided_after, percent format(%9.1f) row

svy: tab wealth delivery_place, percent format(%9.1f) row
svy: tab wealth facility_delivery, percent format(%9.1f) row
svy: tab wealth skilled_birth, percent format(%9.1f) row

** ================ **

svy: tab wealth c_section, count format(%9.0f) miss
svy: tab wealth decided_before, count format(%9.0f) miss
svy: tab wealth decided_after, count format(%9.0f) miss

svy: tab wealth delivery_place, count format(%9.0f) miss
svy: tab wealth facility_delivery, count format(%9.0f) miss
svy: tab wealth skilled_birth, count format(%9.0f) miss

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

ssc install hplot, replace //Need internet connection
ssc install catplot, replace //Need internet connection

catplot c_section wealth [iw=weight], percent(wealth) stack asyvars ///
		bar(1, bcolor(gold*.6)) bar(2, bcolor(ltblue*.9)) bar(3, bcolor(red*.2)) ///
		blabel(bar, format(%9.1f) pos(center)) bar(4, bcolor(gs14)) ytitle(%) ///
		title(Percentage of births delivered by C-section) subtitle(Malawi DHS 2015-16)
	
catplot delivery_place wealth [iw=weight], percent(wealth) stack asyvars ///
		bar(1, bcolor(gold*.6)) bar(2, bcolor(ltblue*.9)) bar(3, bcolor(red*.2)) ///
		blabel(bar, format(%9.1f) pos(center) size(small) orientation(vert)) ///
		bar(4, bcolor(gs14)) ytitle(%) ///
		title(Percent distribution of births by place of delivery) ///
		subtitle(Malawi DHS 2015-16)

catplot facility_delivery wealth [iw=weight], percent(wealth) stack asyvars ///
		bar(1, bcolor(gold*.6)) bar(2, bcolor(ltblue*.9)) bar(3, bcolor(red*.2)) ///
		blabel(bar, format(%9.1f) pos(center)) bar(4, bcolor(gs14)) ytitle(%) ///
		title(Percentage of births by type of health facility) ///
		subtitle(Malawi DHS 2015-16)

catplot skilled_birth wealth [iw=weight], percent(wealth) stack asyvars ///
		bar(1, bcolor(gold*.6)) bar(2, bcolor(ltblue*.9)) bar(3, bcolor(red*.2)) ///
		blabel(bar, format(%9.1f) pos(center)) bar(4, bcolor(gs14)) ytitle(%) ///
		title(Percentage of births by type of provider) ///
		subtitle(Malawi DHS 2015-16)

exit

** <><><><><><><><><><><><><><><><><><>><><><><><><><><><><><><><><><><><><><> **

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging all DHS recode files for one country in Stata
Next Topic: Merging IR and PR?
Goto Forum:
  


Current Time: Tue Jun 2 09:34:05 Eastern Daylight Time 2020