* DHS User Forum inquiry * "I would like to calculate the mean age at childbearing by birth order, * for 3 year period preceding the survey. * Are there any resources on how to calculate such indicator in Stata?" * Response by Tom Pullum, tom.pullum@icfi.com, January 10, 2014 * dob is the child's date of birth * doi is the mother's date of interview * cmc is century month code * bord is birth order * open any BR file gen dob_cmc=b3 gen doi_cmc=v008 * drop births in the month of interview (standard practice) drop if dob_cmc==doi_cmc * restrict births to the 36 months before the interview keep if doi_cmc-dob_cmc<=36 gen age_of_mother_at_dob=(dob_cmc-v011)/12 gen birth_order=bord replace birth_order=12 if bord>12 format age_of_mother_at_dob %6.2f tab birth_order [iweight=v005/1000000] tab birth_order [fweight=v005], summarize(age_of_mother_at_dob) nofreq noobs