Following is another response from DHS Senior Research Associate, Lindsay Mallick:
Thank you for sharing your code. If you notice from the table description, this table only includes information on antenatal care for the most recent birth in the three years preceding the survey. You'll first need to set that as your denominator. You can also simplify your code since this information is only collected for most recent birth- you do not need to specify bidx_01==1 or include m2`x'_`i'.
gen wt=v005/1000000
*denominator for table 9.1
ta v238[iw=wt]
recode v238 (0=0) (1/5=1) (else = .), gen(birth3)
label var birth3 "Had a birth in the last three years"
ta birth3[iw=wt]
*any anc for most recent pregnancy
recode m14_1 (0=0 "no anc") (1/50 =1 "anyanc") (else = 9 "dk/miss"), gen(anyanc)
lab var anyanc "Any ANC for most recent pregnancy"
*Sought antenatal care from trained providers
gen anc_sba=0 if birth3==1
foreach x in a b c d e {
replace anc_sba=1 if m2`x'_1==1
}
lab var anc_sba "ANC from a skilled provider"
The DHS has recently released a series of videos on "Tips & Tricks to Matching the DHS Final Report". Please make sure you've tried the steps outlined in these tutorials:
http://blog.dhsprogram.com/final-report-tables/
https://www.youtube.com/watch?v=tjuaPV4eC_E&feature=yout u.be&list=PLagqLv-gqpTMU3avlnBDodTWCazURy4CT