Hi all,
Could someone please have look at the Stata code below and let me know what it is that I am doing wrong.
I'm trying to replicate Table 9.7 from the PDHS report of 2012-13.
I'm close but there's something that I'm not doing correctly.
Here's the Stata code
** CANNOT REPLICATE TABLE 9.7 OF PDHS 2012-13
/* Table 9.7 Timing of first postnatal checkup for the mother */
/*
What aim I possibly doing wrong in the code below?
The totals (4 246) are fine, but the percentages are off by one or two digits
*/
********************************************************************************
** WEIGHT VARIABLE
gen weight = v005/1000000
********************************************************************************
** SURVEY SET
gen psu = v021
gen strata = v022
svyset psu [pw = weight], strata(strata)
********************************************************************************
** Postnatal care of mother
gen time_mother = 7
replace time_mother = 1 if m51 <= 103
replace time_mother = 2 if m51 >=104 & m51 <=123
replace time_mother = 3 if m51 >=124 & m51 <=202
replace time_mother = 4 if m51 >=203 & m51 <=206
replace time_mother = 5 if m51 >=207 & m51 <=305
replace time_mother = 6 if m51 == 199 | m51 == 998 | m51 == 999
replace time_mother = . if bidx >1
label define time_mother 1"<4 hours" 2"4-23 hours" 3"1-2 days" 4"3-6 days" 5"7-41 days" 6"dnk/missing" 7"Never"
label var time_mother "Mother's timing for postnatal care"
label val time_mother time_mother
svy: tab v190 time_mother if v008-b3<24 & bidx == 1, percent format(%4.1f) row
/*
Example:
For "Less than 4 hours" I do not get 53.7% as in the reports, and there seems
to be other errors in my code. Please assist...
*/
tab v190 time_mother if v008-b3<24 & bidx == 1 [iw = weight], missing
tab v190 time_mother if v008-b3<24 & bidx == 1 [iw = weight], nof row missing
***********************************
** POSTNATAL CARE (postnatal checkup for the mother within two days)
recode time_mother (0/3 = 1 "Yes") (else = 0 "No"), gen(PNC_mother)
label var PNC_mother "Postnatal checkup in the first two days after birth"
label val PNC_mother PNC_mother
********
// CHECK
svy: tab v190 PNC_mother if v008-b3<24 & bidx == 1, percent format(%4.1f) row
tab v190 PNC_mother if v008-b3<24 & bidx == 1 [iw = weight], nof row missing
/*
Not matching Table 9.7 of PDHS 2012-13
*/