The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Bangladesh » Values don't match with reported values/Antenatal care by medically trained professionals
Re: Values don't match with reported values/Antenatal care by medically trained professionals [message #15555 is a reply to message #15554] Sat, 11 August 2018 04:37 Go to previous messageGo to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello Mahmudul,

Please try the code below... I have used the "keep if" command. Hopefully this will work.

Good luck...

/*
	INDIVIDUAL RECODE: BDIR72FL
	BDHS 2014

	BY: MLULEKI TSAWE - (University of the Western Cape, South Africa)

*/

clear all
set matsize 800
set mem 1g
set maxvar 9000
cd "..." // change path
use "BDBR72FL", clear
set more off

********************************************************************************

** WEIGHT VARIABLE
gen weight = v005/1000000

********************************************************************************

** SURVEY SET
gen psu =    v021
gen strata = v023
svyset psu [pw = weight], strata(strata) vce(linearized)
*svydes

********************************************************************************

// RENAME

rename v013 age
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region
*rename sdist district

////////////////////////////////////////////////////////////////////////////////

** QUALIFIED DOCTOR
recode m2a (1=1 "doctor") (0=0 "not doctor") (else=.), gen(doctor)
label var doctor "Antenatal care provided by a doctor"
label val doctor doctor

** NURSE/MIDWIFE/PARAMEDIC
cap drop NMP
gen NMP=.
replace NMP = 0 if m2b==0 | (m2a==1)
replace NMP = 1 if m2b==1 & (m2a ==0)
label define NMP 0"not NMP" 1"NMP"
label var NMP "Antenatal care provided by a nurse/midwife/paramedic"
label val NMP NMP

** FAMILY WELFARE VISITOR
cap drop FWV
gen FWV=.
replace FWV = 0 if m2c==0 | (m2a==1)
replace FWV = 1 if m2c==1 & (m2a ==0 & m2b==0)
label define FWV 0"not FWV" 1"FWV"
label var FWV "Antenatal care provided by a family welfare visitor"
label val FWV FWV

** COMMUNITY SKILLED BIRTH ATTENDANT
cap drop CSBA
gen CSBA=.
replace CSBA = 0 if m2d==0 | (m2a==1)
replace CSBA = 1 if m2d==1 & (m2a ==0 & m2b==0)
label define CSBA 0"not CSBA" 1"CSBA"
label var CSBA "Antenatal care provided by a community skilled birth attendant"
label val CSBA CSBA

** MEDICAL ASSISTANT/SUB-ASSISTANT COMMUNITY MEDICAL OFFICER (MA/SACMO)
cap drop MA_SACMO
gen MA_SACMO=.
replace MA_SACMO = 0 if m2e==0 | (m2a==1)
replace MA_SACMO = 1 if m2e==1 & (m2a ==0 & m2b==0)
label define MA_SACMO 0"not MA_SACMO" 1"MA_SACMO"
label var MA_SACMO "Antenatal care provided by a medical assistant/sub-assistant community medical officer (ma/sacmo)"
label val MA_SACMO MA_SACMO

** COMMUNITY HEALTH CARE PROVIDER
cap drop CHCP
gen CHCP=.
replace CHCP = 0 if m2f==0 | (m2a==1)
replace CHCP = 1 if m2f==1 & (m2a ==0 & m2b==0)
label define CHCP 0"not CHCP" 1"CHCP"
label var CHCP "Antenatal care provided by a community health care provider"
label val CHCP CHCP

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

** SKILLED ANTENATAL CARE PROVIDER

****** Percentage receiving antenatal care from a skilled provider

gen skilled_ANC	=	0
label define skilled_ANC 0"Unskilled" 1"Skilled provider"
label var skilled_ANC "Antenatal care from a skilled provider"
label val skilled_ANC skilled_ANC


foreach xvar of varlist m2a m2b m2c m2d m2e {
replace skilled_ANC=1 if `xvar'==1
}
*

** ANTENATAL CARE VISITS
* Replicating DHS table
cap drop antenatal_dhs
recode m14 (0=0 "None") (1=1 "1") (2=2 "2") (3=3 "3") (4/32=4 "4+") ///
(else=88 "DNK/Missing"), gen(antenatal_dhs)
label var antenatal_dhs "Antenatal visits - as in SLDHS report"
label val antenatal_dhs antenatal_dhs

* Any antenatal care
cap drop any_ANC
recode m14 (1/20=1 "Any ANC") ///
(else=0 "None/DNK/Missing"), gen(any_ANC)
label var any_ANC "Any antenatal care visit"
label val any_ANC any_ANC

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

** DROP IF NOT WITHIN SAMPLE      
keep if m2a!=. | m2b!=. | m2c!=. | m2d!=. | m2e!=.

********************************************************************************

** CHECK
tab skilled_ANC [iw=weight], missing

svy: tab skilled_ANC, count format(%4.0f)
svy: tab skilled_ANC, percent format(%4.1f)
svy: tab wealth skilled_ANC, percent format(%4.1f) row miss

svy: tab antenatal_dhs residence, percent format(%4.1f) col miss

tabstat m14 if antenatal_dhs >=1 & antenatal_dhs <=4  [aw=weight], by(residence) stat(mean sd min max) format(%4.1f) long
tabstat m14 if antenatal_dhs >=1 & antenatal_dhs <=4  [aw=weight], by(age) stat(mean sd min max) format(%4.1f) long

********************************************************************************
********************************************************************************
********************************************************************************

* Mothers 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
svy: tab age_at_birth skilled_ANC, percent format(%4.1f) row miss

*****************************************

* Current age
recode v012 (15/19=1 "<20") (20/34=2 "20-34") (35/49=3 "35=49"), gen(age_current)
label var age_current "Current age of respondent"
label val age_current age_current

* Marital status
recode v501 (1=1 "Married") (else=0 "Not married"), gen (marital_stat)
label var marital_stat "Marital status"
label val marital_stat marital_stat

* 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

* Educational attainment
cap drop educ_attainment
recode v149 (0=0 "No education") (1=1 "Primary incomplete") ///
(2=2 "Primary complete") (3=3 "Secondary incomplete") ///
(4/5=4 "Secondary complete or higher"), gen(educ_attainment)
label var educ_attainment "Educational attainment"
label val educ_attainment educ_attainment

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

** READING NEWSPAPERS (at least once a week)
cap drop news_once
recode v157 (2/3=1 "Yes") (else=0 "No"), gen(news_once)
label variable news_once "Reads a newspaper at least once a week?"
label values news_once news_once

** WATCHES TV (at least once a week)
cap drop watch_tv
recode v159 (2/3=1 "Yes") (else=0 "No"), gen(watch_tv)
label variable watch_tv "Watches television at least once a week?"
label values watch_tv watch_tv

** LISTENS TO THE RADIO (at least once a week)
cap drop listen_radio
recode v158 (2/3=1 "Yes") (else=0 "No"), gen(listen_radio)
label variable listen_radio "Listens to the radio at least once a week?"
label values listen_radio listen_radio

***********************************************************

* ACCESSES ALL THREE MEDIA (at least once a week)

cap drop all_media
gen all_media = 0

foreach groupvar of varlist news_once watch_tv listen_radio {
	replace all_media=1 if (news_once==1 & watch_tv==1 & listen_radio==1)
}
*
label define all_media	0"No"  1"Yes"
label variable all_media "Accesses all three media at least once a week"
label values all_media all_media

* CEB
recode v201 (1=1 "1 child") (2/3=2 "2-3 children") ///
(4/max = 3 "4+ children"), gen (parity)
label var parity "Total number of children ever born = parity"
label val parity parity

* Region and residence = Sub-regions
cap drop sub_region
egen sub_region = group(region residence), label

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

** MORE CHECKS **

*** Table 9.1 Antenatal care ***

svy: tab age_at_birth skilled_ANC, percent format(%4.1f) row miss

svy: tab birth_order skilled_ANC, percent format(%4.1f) row miss

svy: tab residence skilled_ANC, percent format(%4.1f) row miss

svy: tab region skilled_ANC, percent format(%4.1f) row miss

*svy: tab educ_attainment skilled_ANC, percent format(%4.1f) row miss

tab educ_attainment skilled_ANC [iw=weight], row miss nof

svy: tab wealth skilled_ANC, percent format(%4.1f) row miss

svy: tab news_once skilled_ANC, percent format(%4.1f) row

svy: tab watch_tv skilled_ANC, percent format(%4.1f) row

svy: tab listen_radio skilled_ANC, percent format(%4.1f) row

*svy: tab all_media skilled_ANC, percent format(%4.1f) row

svy: tab v130 skilled_ANC, percent format(%4.1f) row

svy: tab v501 skilled_ANC, percent format(%4.1f) row

svy: tab parity skilled_ANC, percent format(%4.1f) row

tab sub_region skilled_ANC [iw=weight], row miss nof

*svy: tab sub_region skilled_ANC, percent format(%4.1f) row

*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*

svy: tab age_at_birth skilled_ANC, count format(%4.0f) miss

svy: tab birth_order skilled_ANC, count format(%4.0f) miss

svy: tab residence skilled_ANC, count format(%4.0f) miss

svy: tab region skilled_ANC, count format(%4.0f) miss

svy: tab educ_attainment skilled_ANC, count format(%4.0f) miss

svy: tab wealth skilled_ANC, count format(%4.0f) miss

svy: tab news_once skilled_ANC, count format(%4.0f) miss

svy: tab watch_tv skilled_ANC, count format(%4.0f) miss

svy: tab listen_radio skilled_ANC, count format(%4.0f) miss

svy: tab all_media skilled_ANC, count format(%4.0f) miss

svy: tab v130 skilled_ANC, count format(%4.0f) miss

svy: tab v501 skilled_ANC, count format(%4.0f) miss

svy: tab parity skilled_ANC, count format(%4.0f) miss

svy: tab sub_region skilled_ANC, count format(%4.0f) miss

exit

********************************************************************************

svy: glm skilled_ANC ib(1).age_at_birth ib(0).marital_stat ///
ib(4).v130 ib(0).educ_attainment ib(1).wealth ib(4).birth_order ///
ib(1).parity ib(0).all_media ib(2).residence ib(1).region, family(binomial) link(logit) eform cformat(%4.1f)

svy: logistic skilled_ANC ib(1).age_at_birth ib(0).marital_stat ///
ib(4).v130 ib(0).educ_attainment ib(1).wealth ib(4).birth_order ///
ib(1).parity ib(0).all_media ib(2).residence ib(1).region, cformat(%4.1f)

/*
svy: logistic skilled_ANC age_at_birth marital_stat ///
v130 educ_attainment wealth birth_order ///
parity all_media residence region

graph bar (mean) skilled_ANC [pweight = weight], over(wealth) blabel(total, format(%6.2f)) ytitle(Average antenatal care use) by(, title(Average antenatal care use by wealth) subtitle(Differentials by residence) note(SLDHS (2013))) by(residence)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Women Employment status
Next Topic: Slight Deviation from Reported Value: BDHS 2014 place of delivery and assistance during delivery
Goto Forum:
  


Current Time: Fri Apr 19 20:29:57 Coordinated Universal Time 2024