Following is a response from DHS Senior Research Associate, Lindsay Mallick:
Dear user,
It does not seem that your categorization of months/trimesters aligns with the categories presented in Table in 9.2 on timing of ANC. I also wonder if your denominator matches.
You can refer to this blog post and corresponding video for more considerations when matching tables: https://blog.dhsprogram.com/final-report-tables/.
Here is some code to match Table 9.2:
gen wt = v005/1000000
recode m13_1 (0/3 = 1 " <4") (4/5 = 2 " 4-5") (6/7 = 3 " 6-7") (8/9 = 4 " 8+") (else = 9 "Don't know/missing") if v208>0, gen(anctime)
replace anctime = 0 if m14_1 ==0, label 0 "None"
label define anctime 0 "No ANC", add
label var anctime "Timing of ANC"
ta anctime [iw=wt]
Best,
Lindsay