Here is code for selecting the children to include. Two important differences with your code:
1) hw1 is not available for all children in this survey, I believe because anthropometry was collected in a subsample of households. It is generally better to calculate age in months using v008-b3.
2) The youngest child under age 2 living with the mother is not always the child with midx=1 (the last child born). It can be that the last child born either died or does not live with the monther, but the next to last child fits the criteria.
use "C:\Data\DHS_Stata\GHKR70FL.DTA", clear
gen age = v008-b3
* select on the living children under 2
keep if age<24 & b5==1
* regroup age
recode age(0/1=1 "0-1")(2/3=2 "2-3")(4/5=3 "4-5")(6/8=4 "6-8")(9/11=5 "9-11")(12/17=6 "12-17")(18/23=7 "18-23")(24/59=.), gen(child_age)
* tabulate for the last column in table 11.3
tab child_age
tab child_age[iw=v005/1000000]
* Now restrict further
* Keep only those living with their mother
keep if b9==0
* and now check if it is the youngest
* children are in order with youngest first, any other child with the same caseid is not the youngest
drop if _n > 0 & caseid == caseid[_n-1]
* tabulate for the number of youngest children under age 2 living with mother
tab child_age
tab child_age[iw=v005/1000000]