Can anyone advise me the stata command for generating table 9.6 of Nepal DHS 2016? It is quite confusing how to take three variables (number of TT injection received in the last preg, TT injection before preg and time of those inj received) into account to identify the proportion of women who received TT ( or MATERNAL and NEONATAL TETANUS protection in the last pregnancy).

use NPIR7HFL.dta, clear
numlabel, add
gen wt = v005/1000000
*generate denominator: any woman who had a birth in the last 5 years
recode v208 (0=0) (1/10=1) (else = .), gen(birth5)
label var birth5 "Had a birth in the last five years"
*******Tetanus*********
*two injections alst pregnancy
gen tet2lastp = 0 if birth5 == 1
replace tet2lastp =1 if m1_1 >1 & m1_1<8
label var tet2lastp "Had 2 or more tetanus shots during last pregnancy"
/*New variable includes mothers with two injections during the pregnancy of their last birth or two or
more injections (the last within 3 years of the last live birth), three or more injections (the
last within 5 years of the last birth), four or more injections (the last within 10 years of the
last live birth), or five or more injections at any time prior to the last birth.*/
*full tetanus
*first calculate total tetanus shots
g totet=0 if birth5 ==1
replace totet=m1_1 if m1_1>0 & m1_1<8
replace totet= m1a_1 + totet if (m1a_1 > 0 & m1a_1 < 8)
*now generating variable for date of last injection - will be 0 for women with at least 1 injection at last pregnancy
*use b19, new CDC age var
g lastinj= 9999
replace lastinj = 0 if m1_1>0 & m1_1<8
gen int age = (b19_01)/12
replace lastinj = m1d_1 - age if m1d_1 <20 & (m1_1==0|(m1_1>7 & m1_1<9996)) // years ago of last shot - (age at of child), yields some negatives
*now generate summary variable for protection against neonatal tetanus
g ttprotect = 0 if birth5==1
replace ttprotect = 1 if tet2lastp ==1
replace ttprotect=1 if totet>=2 & lastinj<=2 //at least 2 shots in last 3 years
replace ttprotect=1 if totet>=3 & lastinj<=4 //at least 3 shots in last 5 years
replace ttprotect=1 if totet>=4 & lastinj<=9 //at least 4 shots in last 10 years
replace ttprotect=1 if totet>=5 //at least 2 shots in lifetime
replace ttprotect=0 if birth5==1 & ttprotect==.
replace ttprotect = . if birth5==0
lab var ttprotect "Full Neonatal Tetanus Protection"
ta ttprotect [iw=wt]

Thank you very much, Lindsay, for your response.
I have another problem in birth preparedness practices; table 9.14, page number 178. Table shows % of pregnant women are prepared for individual birthpreparedness practices. I want to know the % percentage of women who were prepared 4 items out of 7 BPP items. How can I create stata command for this?

The information provided on this Web site is not official U.S. Government information and
does not represent the views or positions of the U.S. Agency for International Development or the U.S. Government.