The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » POSTNATAL CARE FOR MOTHER & NEWBORN IN Stata
POSTNATAL CARE FOR MOTHER & NEWBORN IN Stata [message #17564] Tue, 16 April 2019 09:49
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
FYI

Here I use Ethiopia as an example. This code should probably work for most DHS-7 datasets.

Postnatal Health Check for Mothers

clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "C:\Users\User1\Desktop\ETHIOPIA DHS 2016"
use "ETIR70FL", clear
set more off

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

** WEIGHT VARIABLE
gen weight = v005/1000000
gen wt=weight

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

** SURVEY SET
gen psu =    v021
//gen strata = v022
gen strata = v023
svyset psu [pw = weight], strata(strata) singleunit(centered)
*svydes

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

//generate variable for birth in the last two years	
gen birth2 =0
replace birth2=1 if b19_01<24
	
** ========================================================================== **
	
//PNC TIMING FOR THE MOTHER		
gen momcheck=0 if birth2 ==1 
replace momcheck =1 if (m62_1 ==1 |m66_1==1)  & birth2==1

gen pnc_wm_time   = 999 if (birth2==1 & momcheck ==1) 
replace pnc_wm_time = m63_1 if inrange(m64_1, 11,29) & birth2 ==1 
replace pnc_wm_time = m67_1 if  pnc_wm_time == 999 & inrange(m68_1, 11,29) & birth2 ==1 
replace pnc_wm_time = 0 if momcheck == 0 & birth2 ==1 

cap drop rh_pnc_wm_timing
recode pnc_wm_time (0 242/299 306/899 999 = 7 "No check or past 41 days") ///
(100/103 =1 "less than 4 hours") (104/123 200 = 2 "4 to 23 hours") ///
(124/171 201/202 = 3 "1-2 days")(172/197 203/206 =4 "3-6 days") ///
(207/241 300/305 = 5 "7-41 days") (998=6 "Don't know or missing") if birth2==1, gen(rh_pnc_wm_timing) 
label var rh_pnc_wm_timing "Timing after delivery for mother's PNC check"

** ========================================================================== **
	 
//PNC within 2days for mother	
recode rh_pnc_wm_timing (1/3 =1 "Within 2 days") ///
(else = 0 "Not in 2 days"), gen(rh_pnc_wm_2days) 
label var rh_pnc_wm_2days "PNC check within two days for mother"

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

keep if rh_pnc_wm_timing !=.

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

** RECODE VARIABLES FOR ANALYSIS **

* Mother's age at birth
cap drop agebirth
gen agebirth=(b3_01-v011)/12

cap drop age_at_birth
recode agebirth (min/19.91667=1 "<20") (20/34.91667=2 "20-34") ///
(35/max=3 "35-49"), gen(age_at_birth)
label var age_at_birth "Mother's age at birth"
label val age_at_birth age_at_birth

* Birth order
gen birth_order1		= 	bord_01
replace birth_order1	=	bord_01-1 if b0_01 == 2
replace birth_order1	=	bord_01-2 if b0_01 == 3

recode birth_order1 (1=1 "1") (2/3=2 "2-3") (4/5=3 "4-5") ///
(6/20=4 "6+"), gen(birth_order)
label var birth_order "Birth order"
label values birth_order birth_order

cap drop agebirth birth_order1

** ========================================================================== **
rename rh_pnc_wm_timing mother_PNC
rename rh_pnc_wm_2days mother_PNC2dyas

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

** CHECK **
svy: tab mother_PNC, count format(%9.0f)
svy: tab age_at_birth mother_PNC, percent format(%9.1f) row

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

exit



Postnatal Health Check for Newborns

clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "C:\Users\User1\Desktop\ETHIOPIA DHS 2016"
use "ETKR70FL", clear
set more off

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

** WEIGHT VARIABLE
gen weight = v005/1000000
gen wt=weight

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

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

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

keep if midx == 1 & b19 < 24

gen birth2 =0
replace birth2=1 if b19<24
	
** ========================================================================== **

//PNC TIMING FOR THE BABY
	
gen babycheck=0 if birth2 ==1 
replace babycheck = 1 if (m70==1 | m74==1) & birth2==1

cap drop pnc_baby_time 
gen pnc_baby_time   = 999 if (birth2==1 & babycheck ==1) 
replace pnc_baby_time = m75 if inrange(m76,11,29) & birth2==1 
replace pnc_baby_time = m71 if  pnc_baby_time == 999 & inrange(m72,11,29) & birth2==1 
replace pnc_baby_time = 0 if babycheck == 0 & birth2 ==1 

cap drop baby_PNC
recode pnc_baby_time (100 =1 "<1 hour") (100/103=2 "1-3 hours") ///
(104/123 = 3 "4 to 23 hours") (124/171 201/202 = 4 "1-2 days") ///
(172/197 203/206 =5 "3-6 days") (207/241 300/305 = 6 "7-41 days") ///
(998 =7 "Don't know") (else = 8 "No postnatal check")  if birth2==1, gen(baby_PNC) 
label var baby_PNC "Timing of first postnatal check for the newborn"
label val baby_PNC baby_PNC

cap drop PNC_baby
gen PNC_baby=baby_PNC
replace PNC_baby = 8 if baby_PNC==6
label define PNC_baby	1"<1 hour" 2"1-3 hours" 3"4-23 hours" 4"1-2 days" ///
						5"3-6 days" 7"Don't know" 8"No postnatal check"
label var PNC_baby "Timing of first postnatal check for the newborn"
label val PNC_baby PNC_baby

** ========================================================================== **
	 
//PNC within 2days for mother	
recode PNC_baby (1/4 =1 "Within 2 days") ///
(else = 0 "Not in 2 days"), gen(baby_PNC_2days) 
label var baby_PNC_2days "Percentage of births with a postnatal check during the first 2 days after birth"

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

keep if PNC_baby !=.

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

** RECODE VARIABLES FOR ANALYSIS **

* Mother's age at birth
cap drop agebirth
gen agebirth=(b3-v011)/12
*tab agebirth

cap drop age_at_birth
recode agebirth (min/19.91667=1 "<20") (20/34.91667=2 "20-34") ///
(35/max=3 "35-49"), gen(age_at_birth)
label var age_at_birth "Mother's age at birth"
label val age_at_birth age_at_birth

* Birth order
gen birth_order1		= 	bord
replace birth_order1	=	bord-1 if b0 == 2
replace birth_order1	=	bord-2 if b0 == 3

recode birth_order1 (1=1 "1") (2/3=2 "2-3") (4/5=3 "4-5") ///
(6/20=4 "6+"), gen(birth_order)
label var birth_order "Birth order"
label values birth_order birth_order

cap drop agebirth birth_order1

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

** CHECK **
svy: tab age_at_birth baby_PNC_2days, percent format(%9.1f) row miss
svy: tab age_at_birth PNC_baby, percent format(%9.1f) row miss

exit

Previous Topic: Using igrowup SPSS syntax
Next Topic: Stata Code for child nutrition status
Goto Forum:
  


Current Time: Thu Mar 28 12:23:16 Coordinated Universal Time 2024