Following is a response from Senior DHS Stata Specialist, Tom Pullum:
There are several ways to do this, without using midx. For example, if you want the number of live births in the past 3 years (completed months 0-35) you could do this:
gen ch_35=0
local li=1
while `li'<=6 {
replace ch_35=ch_35+1 if b19_0`li'<35
local li=`li'+1
}
tab ch_35
If you want the number of children born in the past 3 years who are still alive (b5=1) then use the following:
gen ch_35=0
local li=1
while `li'<=6 {
replace ch_35=ch_35+1 if b19_0`li'<35 & b5_0`li'==1
local li=`li'+1
}
tab ch_35
For the number of children born in the past 3 years who died (b5=0) use this:
gen ch_35=0
local li=1
while `li'<=6 {
replace ch_35=ch_35+1 if b19_0`li'<35 & b5_0`li'==0
local li=`li'+1
}
tab ch_35
For the last 5 years (months 0-59), just replace 35 with 59.
All the births in the birth histories are live births. b5 describes survival between the birth and the interview with the mother.