Hi,
I am trying to replicate in the column "Percentage exclusively breastfeeding" in Table 11.4 using the code below taken from DHS GitHub repository
use "KEKR8AFL.dta", clear
**** child's age ****
gen age = v008 - b3
*** Breastfeeding and complementary feeding ***
//currently breastfed
gen nt_bf_curr= m4==95
label values nt_bf_curr yesno
label var nt_bf_curr "Currently breastfeeding - last-born under 2 years"
//breastfeeding status
gen water=0
gen liquids=0
gen milk=0
gen solids=0
*Child is given water
replace water=1 if (v409>=1 & v409<=7)
*Child given liquids
foreach xvar of varlist v409a v410 v410a v412c v413*{
replace liquids=1 if `xvar'>=1 & `xvar'<=7
}
*Given powder/tinned milk, formula, or fresh milk
foreach xvar of varlist v411 v411a {
replace milk=1 if `xvar'>=1 & `xvar'<=7
}
*Given any solid food
foreach xvar of varlist v414* {
replace solids=1 if `xvar'>=1 & `xvar'<=7
}
replace solids=1 if v412a==1 | v412b==1 | m39a==1
gen nt_bf_status=1
replace nt_bf_status=2 if water==1
replace nt_bf_status=3 if liquids==1
replace nt_bf_status=4 if milk==1
replace nt_bf_status=5 if solids==1
replace nt_bf_status=0 if nt_bf_curr==0
label define bf_status 0"not bf" 1"exclusively bf" 2"bf & plain water" 3"bf & non-milk liquids" 4"bf & other milk" 5"bf & complemenatry foods"
label values nt_bf_status bf_status
label var nt_bf_status "Breastfeeding status for last-born child under 2 years"
//exclusively breastfed
recode nt_bf_status (1=1) (else=0) if age<6, gen(nt_ebf)
label values nt_ebf yesno
label var nt_ebf "Exclusively breastfed - last-born under 6 months"
ta nt_ebf [iw=v005]
with no success. Any help will be greatly appreciated.