* do e:\DHS\programs\unified_rates\DHS_adult_and_maternal_mortality_micro_do_29Aug2023.txt * This program matches the short version. It produces a micro file and confidence intervals. set more off * A higher level of maxvar is needed for some IR files. set maxvar 10000 /* ******************************************************************************************************** PROGRAM TO PRODUCE ADULT AND MATERNAL MORTALITY RATES FOR SPECIFIC WINDOWS OF TIME, USING DHS DATA FILES ******************************************************************************************************** Written by Thomas W. Pullum. The program agrees exactly with DHS procedures, except for confidence intervals. It is a complete re-write, not a translation, of the CSPro program. It includes many comments and explanations and is intended for users who are already familiar with demographic rates and with Stata. I avoid abbreviations and programming complexities that would shorten the program but make it a black box for most users. It is expected that you will make modifications. Newer versions will occasionally be put on the website. The program does not include an option for covariates. DHS does not recommend the calculation of maternal mortality rates or ratios within subpopulations and will not facilitate this, but of course users can modify the program if they wish. The only covariates in the data files are characteristics of the respondent, not of her siblings. This program includes a section to get the asfrs, which are needed to calculate a re-weighted GFR. Also the variance-covariance matrix of the asfrs, which is needed for the ci of the re-weighted GFR. This version uses awfactt for the calculation of the asfrs and for the age-adjustment of the GFR and MM Rate. There is no difference between never-married and ever-married surveys in the calculation of the asdrs. It only uses the sibling data in the IR file, from the survey of women. Users can modify if the men's survey included sibling histories. The procedure uses the MR file, but only for the proportion in each five-year age group at the time of the survey, needed for re-weighting the asdrs to get 35m15. If there was no survey of men, the current age distribution can be obtained from the PR file, with modifications to the routine "get_age_distributions". If you are only interested in the women's 35m15 and/or the MMratio, you can use any MR file and ignore the results for men. As is standard DHS practice, exposure or events in the month of interview are ignored. Calculate exposure to successive age intervals within the interval of observation. The age intervals are numbered 1 for 15-19 through 7 for 45-49. The first cmc when the sibling is in age interval i is mm4+(i+2)*60 and the last cmc when the sibling is in age interval i is the first cmc plus 59. The months of exposure to age interval i within the window is mexp_i. first_1 is the cmc when the sibling reached age interval 1 (age 15-19), and last_1 is the last cmc when the sibling was in age interval 1 (age 15-19), etc., up to interval 7 (age 45-49) Structure: the program sets up a worksheet with rows for sex and age group (2 x 7 = 14 rows). The columns give the amounts of exposure, deaths, maternal deaths, and quantities that can be calculated from them. The output by sex lists men for sex=1 and women for sex=2, in the sequence of hv104. When comparing with the reports, note that women are listed before men. The sequence of other output may also be different from the reports. The MMRatio is the MMRate divided by the GFR, where the GFR is from the same time period as the MMRate but is age-standardized according to the age distribution of the women in the IR file. Note that this GFR is defined as the number of births to women 15-49, divided by the number of (or exposure by) women age 15-49; it is not the DHS GFR. mm1 "Sex" mm2 "Survival status" mm3 "Current age" mm4 "Date of birth (cmc)" mm6 "Years since death" mm7 "Age at death" mm8 "Date of death (cmc)" mm9 "Death and pregnancy" mm12 "Length of time between sibling's delivery and death" mm14 "Number of sibling's children" mm16 "Sibling's death due to violence or accident" (In surveys from 2016 onwards) pregnancy-related death: mm9 is 2, 3, 5, or 6, and mm16 is not used maternal death: mm9 is 2, 3, or 5, and mm16=0 mm2 codes: 0 dead 1 alive 8 don't know mm9 codes: 0 never pregnant 1 death not related 2 died while pregnant 3 died during delivery 4 since delivery NOT USED 5 6 weeks after delivery 6 2 months after delivery ADDITIONAL BETWEEN 6 WEEKS AND 2 MONTHS 98 don't know mm12 codes: 100 same day 101 days: 1 199 days: number missing 201 months: 1 299 months: number missing 301 years: 1 399 years: number missing 997 inconsistent 998 don't know mm16 codes 0 no 1 violence 2 accident mm12 is not needed mm4 and mm8 are always coded but may include some impossible values; apparently not always edited mm3 is equivalent to int((v008-mm4)/12) age in years if alive mm6 is equivalent to int((v008-mm8)/12) age in years at death if dead mm7 is equivalent to int((mm8-mm4)/12) years since death if dead Only keep the variables that are needed: mm 1, 2, 4, 8, 9, 16 If mm16 is present and if it equals 1 or 2, then change mm9 from 2 to 1 The program produces several tables that appear in the log file. You can insert lines for tabout, or export excel, or can copy from the log file, whatevere is most convenient for you. All the the main rates, age-specific and overall, age-adjusted, are exported as Stata .dta file and as Excel files, for you to manipulate. 95% confidence intervals are provided for all of the main overall rates. These confidence intervals are calculated on the scale of the log of the rate and then the ends are exponentiated. The intervals are not centered on the point estimate. The point estimate is the geometric mean of L and U, not the arithmetic mean. The intervals are always shorter on the downward side than on the upward side. A standard error for the rate itself is not produced. If you want an estimate of the standard error of the rate itself, use (U-L)/(2*1.96). If you want the standard error of the log rate, it is se=(logU-logL)/(2*1.96). If you want to test the significance of the difference between two rates from two surveys, say R1 and R2, do it on the log scale. The test statistic will be (logR1-logR2)/sqrt(se1^2+se2^2). This will have a z distribution, with .05 two tailed critical values at +/-1.96, etc. The confidence intervals are calculated within a statistical framework. They will not match the DHS jackknife procedure. In general the width of the confidence intervals produced here will be very close to the width of the DHS intervals, but will be displaced slightly upwards because of the asymmetry described in the previous paragraph. The program does four poisson regressions with the age groups stacked. One is for the age-specific fertility rates for the respondents, to get the re-weighted GFR. The other three are for the age-specific death rates for men, age-specific death rates for women, and age-specific pregnancy-related death rates, all based on the sisters. This program does not allow covariates. The rates are given to many decimal places and do not include factors of 1000 or 100,000. YOU MUST APPLY THOSE FACTORS YOURSELF. Executable statements and more comments begin after the multiple rows of asterisks. The program produces three Stata .dta files and three corresponding Excel .xlsx files. You can manipulate them to produce tables. The filenames include the two-character country code, characters 5 and 6 from the IR filename, and the starting and ending dates of the window of time. The log file includes most of the same numbers and also includes the tables on completeness and timing of a maternal death (during pregnancy, at delivery, or afterwards) and sibship size. Those numbers are not included in the output files. */ ****************************************************************************** * SUB PROGRAMS BEGIN HERE ****************************************************************************** * THE FIRST GROUP OF SUB PROGRAMS ARE FOR THE CALCULATION OF THE GFR * THESE ROUTINES ARE BORROWED FROM THE GENERAL PROGRAM FOR FERTILITY RATES ****************************************************************************** ****************************************************************************** program define make_start_month_end_month_GFR * convert lw and uw to cmc's if lw<=0 { * note that lw and uw will be <=0 for "years before survey" * coding that WILL NOT include the month of interview in the most recent interval; * this matches up with DHS results gen start_month=doi+12*lw-12 gen end_month=doi+12*uw-1 * alternative coding that WILL include the month of interview in the most recent interval *gen start_month=doi+12*lw-11 *gen end_month=doi+12*uw } if lw>0 { * lw and uw will be >0 for "calendar years" gen start_month=12*(lw-1900)+1 gen end_month=12*(uw-1900)+12 } replace end_month=min(end_month,doi) end ****************************************************************************** program define setup_GFR rename v008 doi rename v011 dob rename v201 ceb format ceb %5.3f * tab v013, summarize(ceb) means freq renpfix b3_0 b3_ gen curageint=int((doi-dob)/60)-2 summarize ceb scalar maxceb=r(max) local k=maxceb+1 while `k'<=20 { drop b3_`k' local k=`k'+1 } scalar nageints=7 save temp2.dta, replace end ****************************************************************************** program define make_exposure * CALCULATE EXPOSURE TO AGE INTERVALS WITHIN THE WINDOW, IN MONTHS * mexp for months of exposure, yexp for years of exposure use temp2.dta, clear make_start_month_end_month_GFR drop b* local i=1 scalar agestart=180 while `i'<=nageints { gen mexp`i'=min(doi,end_month,dob+agestart+59)-max(start_month,dob+agestart)+1 replace mexp`i'=0 if mexp`i'<0 * must make an adjustment if doi is the last month in an interval * in that case, half a month must be deducted, under the assumption that the * interview was in the middle of the month * find the current age interval and subtract half a month of exposure replace mexp`i'=mexp`i'-.5 if end_month>=doi & curageint==`i' scalar agestart=agestart+60 local i=`i'+1 } * At this point inflate the exposure by awfactt/100 if this is an ever-married sample. * Do not need any other versions of awfactt, such as awfactu, because these rates should * only be calculated for the total, not for subpopulations. * Note that this correction will be off if there have been changes in the age distribution * of marriage between the date of the estimate and the date of the survey!! * Must first check whether awfactt is in the data. If not, construct it. local i=1 while `i'<=nageints { replace mexp`i'=(awfactt/100)*mexp`i' local i=`i'+1 } sort caseid save exposure.dta, replace end ****************************************************************************** program define make_births * MAKE FILE OF ALL BIRTHS use temp2.dta, clear keep caseid b3_* clusterid stratumid reshape long b3_, i(caseid) j(order) drop if b3_==. rename b3_ cmcbirth sort caseid save births.dta,replace drop _all use temp2.dta make_start_month_end_month_GFR keep caseid dob start_month end_month clusterid stratumid sort caseid merge caseid using births.dta * tab _merge drop _merge scalar list lw uw * drop births that lie outside the window drop if cmcbirthend_month *calculate births in age intervals within the window local i=1 scalar agestart=180 while `i'<=nageints { gen births`i'=0 replace births`i'=births`i'+1 if cmcbirth<=dob+agestart+59 & cmcbirth>=dob+agestart scalar agestart=agestart+60 local i=`i'+1 } drop cmcbirth collapse (sum) births*, by(caseid) sort caseid save births.dta,replace end ****************************************************************************** program define make_exposure_and_births quietly make_exposure quietly make_births use exposure.dta,replace merge caseid using births.dta tab _merge drop _merge * The following line may or may not make any difference for the accuracy of the calculations recast double mexp* v005 * We now have a woman-level file that includes each woman's exposure and births * in each of the age intervals and in the specified time interval. * It will help to know the woman-years of exposure used for the GFR; call it yexp_GFR to distinguish * from the person-years of exposure for the mortality rates local i=1 while `i'<=nageints { gen yexp_GFR`i'=mexp`i'/12 gen lnyexp_GFR`i'=ln(yexp_GFR`i') replace births`i'=. if mexp`i'==0 replace births`i'=0 if births`i'==. & mexp`i'>0 local i=`i'+1 } sort caseid save exposure_and_births, replace end ****************************************************************************** program define calc_rates * Just calculate the asfrs; no need for GFR or for covariates and categories use exposure_and_births.dta, clear *egen stratumid=group(v024 v025) *gen clusterid=v021 egen womanid=group(caseid) /* * This section can be used to get the unadjusted GFR, but it's not actually needed, so it is commented out egen births_GFR=rowtotal(births1 births2 births3 births4 births5 births6 births7) egen mexp_GFR=rowtotal(mexp1 mexp2 mexp3 mexp4 mexp5 mexp6 mexp7) gen lnyexp_GFR=log(mexp_GFR/12) * Section is not needed * Get the GFR and ci *********************** svyset clusterid [pweight=v005], strata(stratumid) singleunit(centered) *********************** *********************** svy: poisson births_GFR, offset(lnyexp_GFR) *********************** matrix T=r(table) scalar sGFR=exp(T[1,1]) scalar se_logGFR=T[2,1] scalar list sGFR se_logGFR */ * REDUCED SECTION FOR MICRO MODEL; JUST SAVE THE ASFRs AND VARIANCE-COVARIANCE MATRIX * To get asfrs: stack the births and exposure with reshape long; do a single poisson regression keep *id births* lnyexp_GFR* v005 awfact* *********************** reshape long births lnyexp_GFR, i(womanid) j(age_grp) *********************** * This file has one record with births and exposure for each age interval for each woman * Construct dummy variables for ALL age groups (noomit and nocons are crucial!). xi, noomit i.age_grp rename _I* * * births will have code "." if there is no exposure to the age interval; drop such lines drop if births==. * You can choose whether to treat women or sample clusters as level 2 units. * This will only affect the confidence intervals. * The intervals are slightly wider, and probably more accurate, with womanid than with clusterid. * Ideally you would use a multi-level model, with age intervals nested in women nested in sample clusters. *********************** svyset clusterid [pweight=v005], strata(stratumid) singleunit(centered) *********************** *svyset womanid [pweight=v005], strata(stratumid) singleunit(centered) *********************** *********************** svy: poisson births age_grp_*, offset(lnyexp_GFR) nocons *********************** matrix T_asfr=r(table) matrix list T_asfr matrix V_asfr=e(V) matrix list V_asfr local li=1 while `li'<=7 { scalar fx`li'=exp(T_asfr[1,`li']) * must make a correction for any earlier time intervals that have no births if T_asfr[1,`li']==0 { scalar fx`li'=0 } * for checking, you can save the numerators and denominators of these rates *quietly summarize births [iweight=v005/1000000] if age_grp==`li' *scalar births`li'=r(sum) *quietly summarize yexp_GFR [iweight=v005/1000000] if age_grp==`li' *scalar yexp_GFR`li'=r(sum) local li=`li'+1 } end ****************************************************************************** program define main_GFR_for_mm local lpath=spath local lfn_IR=sfn_IR use "`lpath'\\`lfn_IR'", clear capture confirm numeric variable awfactt, exact if _rc>0 { gen awfactt=100 } keep caseid v001 v005 v008 v011 v021 v023-v025 v201 b3_* awfactt rename v021 clusterid if sv023_NA==0 { rename v023 stratumid } if sv023_NA==1 { egen stratumid=group(v024 v025) } save temp1.dta, replace quietly setup_GFR * lw and uw enter this version of the program from the mm program * The usual values are lw=-6 and uw=0 make_exposure_and_births calc_rates erase temp1.dta erase temp2.dta end ****************************************************************************** ****************************************************************************** * THE PRECEDING ROUTINES CALCULATE THE GFR. NOW GO TO THE OTHER ROUTINES. ****************************************************************************** ****************************************************************************** program define start_month_end_month * This routine calculates the end date and start date for the desired window of time /* There are two ways to specify the window of time. Method 1: as calendar year intervals, e.g. with scalar lw=1992 scalar uw=1996 for a window from January 1992 through December 1996, inclusive. Method 2: as an interval before the date of interview, e.g. with scalar lw=-2 scalar uw=0 for a window from 0 to 2 years before the interview, inclusive (that is, three years) The program knows you are using method 2 if the two numbers you enter are negative or zero. lw is the lower end of the window and uw is the upper end. (Remember that both are negative or 0.) start_month is the cmc for the earliest month in the window and end_month is the cmc for the latest month in the window */ gen doi=v008 * Section for "years before survey". lw and uw will be <=0 if lw<=0 { * coding that WILL NOT include the month of interview in the most recent interval; matches with DHS results gen start_month=doi+12*lw-12 gen end_month=doi+12*uw-1 * alternative coding that includes the month of interview in the most recent interval; * this will NOT match the DHS results *gen start_month=doi+12*lw-11 *gen end_month=doi+12*uw } * Section for calendar years. lw and uw will be >0 if lw>0 { * lw and uw will be >0 for "calendar years" gen start_month=12*(lw-1900)+1 gen end_month=12*(uw-1900)+12 } replace end_month=min(end_month,doi) * calculate the reference date summarize start_month [iweight=v005/1000000] scalar mean_start_month=r(mean) summarize end_month [iweight=v005/1000000] scalar mean_end_month=r(mean) * Convert back to continuous time, which requires an adjustment of half a month (i.e. -1/24). * This adjustment is not often made but should be. scalar refdate=1900-(1/24)+((mean_start_month+mean_end_month)/2)/12 summarize doi [iweight=v005/1000000] scalar mean_doi=1900-(1/24)+(r(mean))/12 end *************************************************************************** program define setup_adult_mm_vars * Go to the IR file and reshape the mm variables. local lpath=spath local lfn_IR=sfn_IR use "`lpath'\\`lfn_IR'", clear * Make a file of sisters keep v000 v001 v002 v003 v005 v008 v010 v013 v021-v025 mm* awfact* * This file includes all women, including women with no siblings, and is needed later sort v001 v002 v003 save IR_all_women.dta, replace gen clusterid=v021 if sv023_NA==0 { rename v023 stratumid } if sv023_NA==1 { egen stratumid=group(v024 v025) } * Need to check for mm16; if an older survey, must give it a value capture confirm numeric variable mm16_01, exact if _rc>0 { local li=1 while `li'<=20 { gen mm16_`li'=. local li=`li'+1 } } ren *_0* *_* drop mmc* mmidx* mm5* mm10* mm11* mm12* mm13* mm14* mm15* quietly reshape long mm1_ mm2_ mm3_ mm4_ mm6_ mm7_ mm8_ mm9_ mm16_, i(v001 v002 v003) j(mmidx) rename mm*_ mm* * Drop any cases with sex missing, i.e. mm1>2 drop if mm1>2 ***************************************************************** * Important for redefinition of PRMR in surveys from 2016 onwards * If mm9=2, and mm16=1 or 2, recode mm9 to 1 *replace mm9=1 if mm9==2 & (mm16==1 | mm16==2) * For earlier surveys that do not include mm16, it is only possible to calculate PRMR; * what was previously called mm is now called prm ***************************************************************** * This file has one record for each sibling. It is needed for the tables on completeness of information. save workfile.dta, replace * Crucial: drop cases in which survival status is dk AFTER saving workfile drop if mm2>1 * specify the lower and upper cmcs of the interval of observation, start_month and end_month, * using scalars lw and uw that were set earlier; usually lw=-6 and uw=0, but not always! start_month_end_month rename mm1 sex * Table x * Tabulate the timing--during pregnancy, at childbirth, afterwards * tabulate mm9 for all maternal deaths, unweighted tab mm9 * tabulate mm9 for all maternal deaths, weighted tab mm9 [iweight=v005/1000000] * tabulate mm9 for all maternal deaths in the window, unweighted tab mm9 if mm8>=start_month & mm8<=end_month * tabulate mm9 for all maternal deaths in the window, weighted tab mm9 if mm8>=start_month & mm8<=end_month [iweight=v005/1000000] save adult_mm_vars.dta, replace * adult_mm_vars.dta is an individual-level file for with one record for each sibling in the IR file. * If there was also a sibling module in the men's survey, a parallel routine must be added. end *************************************************************************** program define completeness_of_information * This routine calculates the table on completeness of information. * It does not depend on the window of time that is used for the rates. * NOTE!! The data quality tables may be UNWEIGHTED, as in Cambodia 2014, or WEIGHTED, as in Tanzania 2010; * here they will be produced both unweighted and weighted use workfile.dta, clear * Table x * Tabulate survival status by sex for all deaths, weighted tab mm2 mm1,m * tabulate survival status by sex for all deaths, unweighted tab mm2 mm1 [iweight=v005/1000000],m * there should not be any cases with survival status=9 or NA, but if there are, * change to dk replace mm2=8 if mm2>8 * If the sibling is alive: label for mm3 indicates that age is missing if mm3 is 98. * However, it appears that "." is used. Allow for 99 too. * Similarly for mm6 and mm7 gen age_AD_YSD_missing=. replace age_AD_YSD_missing=0 if mm2==1 replace age_AD_YSD_missing=1 if mm2==1 & (mm3==98 | mm3==99 | mm3==.) tab age_AD_YSD_missing mm1,col * If the sibling has died, YSD is years since death (mm6) and AD is age at death (mm7). gen YSD_missing=0 gen AD_missing=0 replace YSD_missing=1 if mm2==0 & (mm6==98 | mm6==99 | mm6==.) replace AD_missing=1 if mm2==0 & (mm7==98 | mm7==99 | mm7==.) replace age_AD_YSD_missing=2 if mm2==0 replace age_AD_YSD_missing=3 if mm2==0 & AD_missing==1 & YSD_missing==0 replace age_AD_YSD_missing=4 if mm2==0 & AD_missing==0 & YSD_missing==1 replace age_AD_YSD_missing=5 if mm2==0 & AD_missing==1 & YSD_missing==1 #delimit ; label define age_AD_YSD_missing 0 "Living, age reported" 1 "Living, age missing" 2 "Dead, AD and YSD reported" 3 "Dead, missing only AD" 4 "Dead, missing only YSD" 5 "Dead, missing AD and YSD"; #delimit cr label values age_AD_YSD_missing age_AD_YSD_missing * Table x * top panel * survival status by sex for all deaths, unweighted and weighted, percentaged tab mm2 mm1, col tab mm2 mm1 [iweight=v005/1000000], col * middle panel * incompleteness of date by sex for surviving siblings tab age_AD_YSD_missing mm1 if mm2==1, col tab age_AD_YSD_missing mm1 if mm2==1 [iweight=v005/1000000], col * bottom panel * incompleteness of date by sex for dead siblings tab age_AD_YSD_missing mm1 if mm2==0, col tab age_AD_YSD_missing mm1 if mm2==0 [iweight=v005/1000000], col end *************************************************************************** program define get_age_distributions * For standardization of 35m15 and the GFR we need the current distribution across five-year age intervals. * For women, use the IR file; for men (15-49 only) use the MR file. * The age distribution for men is needed ONLY for calculating the age-standardized death rate for ages 15-49, i.e. 35m15. * Age is considered to be more accurate in the IR and MR files than in the PR file; * otherwise we could use age in the PR file. If there is no MR file, use the PR file. * We also need to do age-sex standardization of the total, and for that we need the PR file **********************begin PR segment for the joint age-sex distribution * Segment to get the age distribution of men from the PR file, for standardization * of the brothers' age distribution. local lpath=spath local lfn_PR=sfn_PR use hv005 hv103-hv105 using "`lpath'\\`lfn_PR'", clear * restrict to de facto men and women in age range keep if hv103==1 & hv105>=15 & hv105<=49 keep hv005 hv104 gen sex=hv104 * may need to remove hh cases with hv104 missing keep if sex<=2 gen sex_wt=hv005/1000000 collapse (sum) sex_wt,by(sex) total sex_wt matrix T=e(b) scalar stotal=T[1,1] scalar sprop_male=sex_wt[1]/stotal scalar sprop_female=sex_wt[2]/stotal scalar list sprop_male sprop_female **********************end PR segment * ONE OR THE OTHER OF THE NEXT TWO SEGMENTS (FOR PR OR FOR MR) MUST BE USED * FOR AGE STANDARDIZATION OF 35m15 FOR MEN /* **********************begin PR segment * Segment to get the age distribution of men from the PR file, for standardization * of the brothers' age distribution. local lpath=spath local lfn_PR=sfn_PR use hv005 hv103-hv105 using "`lpath'\\`lfn_PR'", clear * restrict to de facto males in age range keep if hv103==1 & hv104==1 & hv105>=15 & hv105<=49 keep hv005 hv105 gen age_grp=-2+int(hv105/5) gen age_prop=hv005/1000000 **********************end PR segment */ **********************begin MR segment * Segment to get the age distribution of men in the MR file, for standardization * of the brothers' age distribution. local lpath=spath local lfn_MR=sfn_MR use mv005 mv012 mv013 using "`lpath'\\`lfn_MR'", clear * restrict age range if necessary keep if mv012>=15 & mv012<=49 keep mv005 mv013 rename mv013 age_grp gen age_prop=mv005/1000000 **********************end MR segment collapse (sum) age_prop,by(age_grp) quietly summarize age_prop replace age_prop=age_prop/r(sum) gen sex=1 sort age_grp * save these weights as scalars for easier use in calc_ci local li=1 while `li'<=7 { scalar age_prop_men`li'=age_prop[`li'] local li=`li'+1 } save age_dist_m.dta, replace * Segment to get the age distribution of women in the IR file, for standardization of the sisters' age distribution. * The age distribution must use awfactt for women local lpath=spath local lfn_IR=sfn_IR use "`lpath'\\`lfn_IR'", clear keep v005 v013 awfact* rename v013 age_grp gen age_prop=(v005/1000000)*(awfactt/100) collapse (sum) age_prop,by(age_grp) quietly summarize age_prop replace age_prop=age_prop/r(sum) gen sex=2 sort age_grp * save these weights as scalars for easier use in calc_ci local li=1 while `li'<=7 { scalar age_prop_women`li'=age_prop[`li'] local li=`li'+1 } save age_dist_f.dta, replace append using age_dist_m.dta gen sex_prop=. replace sex_prop=sprop_male if sex==1 replace sex_prop=sprop_female if sex==2 sort sex age_grp /* * save these weights as scalars for easier use in calc_ci local li=1 while `li'<=7 { scalar age_prop_men`li'=age_prop[`li'] local liplus7=`li'+7 scalar age_prop_women`li'=age_prop[`liplus7'] local li=`li'+1 } */ save sex_age_dist.dta, replace * sex_age_dist.dta has 2 x 7 = 14 lines. It gives the "best" age distribution of men and women * at the time of the survey, as the proportions of each sex who are in each of the 7 age groups. * sex_prop is the proportion male in the PR files (same for all age groups) and the proportion * female (same for all age groups) end *************************************************************************** program define sibship_size_and_sex_ratio * This routine calculates the table on sibship size and the sex ratio, which is always WEIGHTED. * It will be easiest to save a temporary file and then return to that file at the end use workfile.dta, clear * The current file has siblings as cases. * For sibship size, we keep the siblings with sex missing, but exclude them from the sex ratio. gen unwtd_brothers=. replace unwtd_brothers=0 if mm1==2 replace unwtd_brothers=1 if mm1==1 gen wtd_brothers=unwtd_brothers*v005/1000000 gen unwtd_sisters=. replace unwtd_sisters=0 if mm1==1 replace unwtd_sisters=1 if mm1==2 gen wtd_sisters=unwtd_sisters*v005/1000000 gen unwtd_nosex=. replace unwtd_nosex=1 if mm1==8 gen wtd_nosex=unwtd_nosex*v005/1000000 * Collapse so respondents are cases; sum the siblings for each respondent, by age group of the respondent. collapse (mean) v005 v010 v013 awfact* (sum) *wtd* , by(v001 v002 v003) * Now have one record per respondent, but this file, which is constructed from a file of siblings, does not * include women who had no siblings. To get the distribution of number of siblings, including women with no * siblings at all, it is necessary to merge with the IR file. sort v001 v002 v003 merge v001 v002 v003 using IR_all_women.dta tab _merge drop _merge replace unwtd_brothers=0 if unwtd_brothers==. replace wtd_brothers=0 if wtd_brothers==. replace unwtd_sisters=0 if unwtd_sisters==. replace wtd_sisters=0 if wtd_sisters==. * Now must add the respondent back into the subship. gen unwtd_resp=1 gen wtd_resp=v005/1000000 * yob refers to the respondent's year of birth gen minyob=v010 gen maxyob=v010 * Next collapse by age groups of respondent, averaging the numbers of siblings collapse (sum) *wtd* (min) minyob (max) maxyob, by(v013) gen wtd_mean_sibship=(wtd_brothers+wtd_sisters+wtd_resp)/wtd_resp gen wtd_sex_ratio=100*wtd_brothers/wtd_sisters * Table x. Note that age groups are listed in reverse order gen v013r=-v013 sort v013r drop v013r list v013 minyob maxyob wtd_mean_sibship wtd_sex_ratio, table clean abbreviate(20) collapse (sum) *wtd* (min) minyob (max) maxyob replace wtd_mean_sibship=(wtd_brothers+wtd_sisters+wtd_resp)/wtd_resp replace wtd_sex_ratio=100*wtd_brothers/wtd_sisters * Totals row of table x. list wtd_mean_sibship wtd_sex_ratio, table clean abbreviate(20) end *************************************************************************** program define get_exposure_and_deaths * Now construct the adult and maternal mortality rates. Calculate exposure, deaths, preganancy-related * deaths, and maternal deaths for each sibling by looping through the seven age intervals use adult_mm_vars.dta, clear local li=1 quietly while `li'<=7 { scalar si=`li' * For each sibling, calculate the first cmc and last cmc when he/she was in each age interval. gen first_`li'=mm4+(`li'+2)*60 gen last_`li'=first_`li'+59 * These boundaries will typically extend into the future. That should not be a problem because the specified * time intervals are always prior to the survey, but make an adjustment to truncate. replace last_`li'=end_month if first_`li'<=end_month & last_`li'>=end_month replace first_`li'=. if first_`li'>end_month replace last_`li'=. if first_`li'>end_month * If there is a death in age interval i, replace last_i with mm8 (the month of death) and then replace all * subsequent values of first and last with . (not applicable). Crucial for correct calculation of exposure. replace last_`li'=mm8 if first_`li'<=mm8 & last_`li'>=mm8 & mm8<. replace first_`li'=. if first_`li'>mm8 replace last_`li'=. if first_`li'>mm8 * Identify deaths in the interval of age and time. Very important for all the rates and ratios. * Note that PR includes mm9=6. Not good but gives a match with MM estimates before the question on * violence and accidents was added ************************************************* gen deaths_in_`li'=0 replace deaths_in_`li'=1 if (first_`li'<=mm8 & last_`li'>=mm8) & (start_month<=mm8 & end_month>=mm8) gen prdeaths_in_`li'=0 replace prdeaths_in_`li'=1 if deaths_in_`li'==1 & mm9>=2 & mm9<=6 gen mdeaths_in_`li'=0 *replace mdeaths_in_`li'=1 if deaths_in_`li'==1 & mm9>=2 & mm9<=5 & mm16==0 * Preceding line switched out on August 29, 2023 replace mdeaths_in_`li'=1 if deaths_in_`li'==1 & (mm9==3 | (mm9==2 & mm16==0) | (mm9==5 & mm16==0)) ************************************************* * Calculate exposure by subtraction gen mexp_`li'=0 replace mexp_`li'=last_`li' -start_month+1 if first_`li' =start_month replace mexp_`li'=last_`li' -first_`li'+1 if first_`li' >=start_month & last_`li'<=end_month replace mexp_`li'=end_month -first_`li'+1 if first_`li' <=end_month & last_`li'> end_month replace mexp_`li'=0 if mexp_`li'<0 local li=`li'+1 } drop first* last* start end * Reshape into a long file reshape long deaths_in_ prdeaths_in_ mdeaths_in_ mexp_, i(v001 v002 v003 mmidx) j(age_grp) rename *_ * drop if mexp==. | mexp==0 * Convert months of exposure to years of exposure at this point. gen yexp=mexp/12 rename deaths_in died rename prdeaths_in prdied rename mdeaths_in mdied * This is a file with one record for each sibling's exposure to each age group in the window. * It can be used for very detailed modeling. gen lw=lw gen uw=uw local lfn=sfn_IR gen str12 file="`lfn'" label variable mm2 "Survival status" label variable mm3 "Current age" label variable mm4 "Date of birth (cmc)" label variable mm6 "Years since death" label variable mm7 "Age at death" label variable mm8 "Date of death (cmc)" label variable mm9 "Death and pregnancy" label variable mm16 "Sibling's death due to violence or accident" save micro.dta, replace drop lw uw file end *************************************************************************** program define calc_mortality_rates * REDUCED MICRO ANALYSIS TO GET THE AGE-SPECIFIC MMRATES AND VARIANCE-COVARIANCE MATRIX * This is a binary outcome but we want a rate, not a probability, so use poisson, not logit. *use micro.dta, clear gen brother=0 replace brother=1 if sex==1 gen lnyexp=log(yexp) gen sister=0 replace sister=1 if sex==2 *********************** svyset clusterid [pweight=v005], strata(stratum) singleunit(centered) *********************** * The following stacked poisson models produce the age-specific death rates. * The iterations limit should only kick in if the number of deaths is close to 0. * Construct dummy variables for ALL age groups ("noomit" is crucial!). xi, noomit i.age_grp rename _I* * * To get the logs of the age-specific death rates for men *********************** svy, subpop(brother): poisson died age_grp_*, offset(lnyexp) nocons iter(50) *********************** matrix T_men_asdr=r(table) matrix V_men_asdr=e(V) * To get the logs of the age-specific death rates for women *********************** svy, subpop(sister): poisson died age_grp_*, offset(lnyexp) nocons iter(50) *********************** matrix T_women_asdr=r(table) matrix V_women_asdr=e(V) * To get the logs of the age-specific pregnancy-related death rates for women *********************** svy, subpop(sister): poisson prdied age_grp_*, offset(lnyexp) nocons iter(50) *********************** matrix T_pr_asdr=r(table) matrix V_pr_asdr=e(V) * To get the logs of the age-specific maternal death rates for women *********************** svy, subpop(sister): poisson mdied age_grp_*, offset(lnyexp) nocons iter(50) *********************** matrix T_maternal_asdr=r(table) matrix V_maternal_asdr=e(V) * Note--to match with the reports, we also produce the numerators and denominators of these rates, which can also be * used to calculate the rates. The model-based calculation is included largely for constructing confidence intervals. local li=1 while `li'<=7 { scalar men_asdr`li'=exp( T_men_asdr[1,`li']) scalar women_asdr`li'=exp( T_women_asdr[1,`li']) scalar pr_asdr`li'=exp(T_pr_asdr[1,`li']) scalar maternal_asdr`li'=exp(T_maternal_asdr[1,`li']) local li=`li'+1 } /* For testing scalar list pr_asdr1 pr_asdr2 pr_asdr3 pr_asdr4 pr_asdr5 pr_asdr6 pr_asdr7 scalar list maternal_asdr1 maternal_asdr2 maternal_asdr3 maternal_asdr4 maternal_asdr5 maternal_asdr6 maternal_asdr7 */ * Collapse the micro file to what is needed for the numerators and denominators of the rates. drop mm2-mm16 mexp* gen unwtd_n=1 gen wtd_n=v005/1000000 gen unwtd_deaths=died*unwtd_n gen wtd_deaths=died*wtd_n gen unwtd_prdeaths=prdied*unwtd_n gen wtd_prdeaths=prdied*wtd_n gen unwtd_mdeaths=mdied*unwtd_n gen wtd_mdeaths=mdied*wtd_n gen unwtd_yexp=yexp*unwtd_n gen wtd_yexp=yexp*wtd_n drop *wtd_n collapse (sum) *wtd*, by(age_grp sex) sort sex age_grp gen wtd_drate=wtd_deaths/wtd_yexp gen wtd_prdrate=wtd_prdeaths/wtd_yexp gen wtd_mdrate=wtd_mdeaths/wtd_yexp gen wtd_prpmdf=wtd_prdeaths/wtd_deaths gen wtd_mpmdf=wtd_mdeaths/wtd_deaths save exposure_and_deaths.dta, replace * exposure_and_deaths.dta is a collapsed file with all deaths, pr deaths, m deaths, and exposure end *************************************************************************** program define calc_ci /* This routine calculates confidence intervals for the reweighted or standardized rates: Drate_men, which is 35m15, the death rate for men; Drate_women, which is 35m15, the death rate for women; MMRate, the maternal mortality rate; GFR, the General Fertility Rate; and MMRatio, the maternal mortality ratio. The first four are simply the sum of the age-specific rates, weighted by the age distributions of men or women at the time of the survey; MMRatio is MMRate/GFR. The calculations are done with scalars and matrices using the delta method. The results are then added to the file as variables. R is the adjusted overall rate F is a function of the compound rate, in all these cases F=log(R) V is the relevant variance-covariance matrix of the underlying b's (poisson regression coefficients). D is the vector of derivatives of F with respect to the b's. C is a constant that has been factored out of D; it must be squared se2 is the standard error of F The following procedure could be made more efficient but with little real gain. */ * se and ci for the reweighted Drate_men scalar R=sDrate_men_rewtd scalar F=log(R) scalar C=(1/R) local li=1 while `li'<=7 { scalar d`li'=age_prop_men`li'*exp(T_men_asdr[1,`li']) local li=`li'+1 } matrix D=(d1,d2,d3,d4,d5,d6,d7) matrix M=(C*C)*D*V_men_asdr*D' scalar se2_men=M[1,1] scalar LF=F-1.96*sqrt(se2_men) scalar UF=F+1.96*sqrt(se2_men) scalar sDrate_men_rewtd_L=exp(LF) scalar sDrate_men_rewtd_U=exp(UF) * se and ci for the reweighted Drate_women scalar R=sDrate_women_rewtd scalar F=log(R) scalar C=(1/R) local li=1 while `li'<=7 { scalar d`li'=age_prop_women`li'*exp(T_women_asdr[1,`li']) local li=`li'+1 } matrix D=(d1,d2,d3,d4,d5,d6,d7) matrix M=(C*C)*D*V_women_asdr*D' scalar se2_women=M[1,1] scalar LF=F-1.96*sqrt(se2_women) scalar UF=F+1.96*sqrt(se2_women) scalar sDrate_women_rewtd_L=exp(LF) scalar sDrate_women_rewtd_U=exp(UF) * se and ci for the reweighted PRMRate scalar R=sPRMRate_rewtd scalar F=log(R) scalar C=(1/R) local li=1 while `li'<=7 { scalar d`li'=age_prop_women`li'*exp(T_pr_asdr[1,`li']) local li=`li'+1 } matrix D=(d1,d2,d3,d4,d5,d6,d7) matrix M=(C*C)*D*V_maternal_asdr*D' scalar se2_PRMRate=M[1,1] scalar LF=F-1.96*sqrt(se2_PRMRate) scalar UF=F+1.96*sqrt(se2_PRMRate) scalar sPRMRate_rewtd_L=exp(LF) scalar sPRMRate_rewtd_U=exp(UF) * se and ci for the reweighted MMRate scalar R=sMMRate_rewtd scalar F=log(R) scalar C=(1/R) local li=1 while `li'<=7 { scalar d`li'=age_prop_women`li'*exp(T_maternal_asdr[1,`li']) local li=`li'+1 } matrix D=(d1,d2,d3,d4,d5,d6,d7) matrix M=(C*C)*D*V_maternal_asdr*D' scalar se2_MMRate=M[1,1] scalar LF=F-1.96*sqrt(se2_MMRate) scalar UF=F+1.96*sqrt(se2_MMRate) scalar sMMRate_rewtd_L=exp(LF) scalar sMMRate_rewtd_U=exp(UF) * se and ci for the reweighted GFR scalar R=sGFR_rewtd scalar F=log(R) scalar C=(1/R) local li=1 while `li'<=7 { scalar d`li'=age_prop_women`li'*exp(T_asfr[1,`li']) local li=`li'+1 } matrix D=(d1,d2,d3,d4,d5,d6,d7) matrix M=(C*C)*D*V_asfr*D' scalar se2_GFR=M[1,1] scalar LF=F-1.96*sqrt(se2_GFR) scalar UF=F+1.96*sqrt(se2_GFR) scalar sGFR_rewtd_L=exp(LF) scalar sGFR_rewtd_U=exp(UF) * se and ci for the reweighted PRMRatio * [log(PRMRatio)]=[log(PRMRate)]-[log(GFR)] * var[log(PRMRatio)]=var[log(PRMRate)]+var[log(GFR)]=se2_PRMRate+se2_GFR=se2 scalar F=log(sPRMRate_rewtd)-log(sGFR_rewtd) scalar se2=se2_PRMRate+se2_GFR scalar LF=F-1.96*sqrt(se2) scalar UF=F+1.96*sqrt(se2) scalar sPRMRatio_L=exp(LF) scalar sPRMRatio_U=exp(UF) * se and ci for the reweighted MMRatio * [log(MMRatio)]=[log(MMRate)]-[log(GFR)] * var[log(MMRatio)]=var[log(MMRate)]+var[log(GFR)]=se2_MMRate+se2_GFR=se2 scalar F=log(sMMRate_rewtd)-log(sGFR_rewtd) scalar se2=se2_MMRate+se2_GFR scalar LF=F-1.96*sqrt(se2) scalar UF=F+1.96*sqrt(se2) scalar sMMRatio_L=exp(LF) scalar sMMRatio_U=exp(UF) end *************************************************************************** program define merge_files * Combine all components into a single file with 2 x 7 = 14 columns: * sex_age_dist.dta * exposure_and_deaths.dta * fertility_rates.dta use sex_age_dist.dta, clear merge sex age_grp using exposure_and_deaths.dta drop _merge sort sex age_grp gen fx=. local li=1 while `li'<=7 { replace fx=fx`li' if age_grp==`li' & sex==2 local li=`li'+1 } list, table clean * Calculate rates and standardize on the current age distribution gen fx_rewtd=fx*age_prop gen mx=wtd_deaths/wtd_yexp gen mx_rewtd=mx*age_prop gen prpmdf=wtd_prdeaths/wtd_deaths gen mpmdf=wtd_mdeaths/wtd_deaths gen prmx=wtd_prdeaths/wtd_yexp gen prmx_rewtd=prmx*age_prop gen mmx=wtd_mdeaths/wtd_yexp gen mmx_rewtd=mmx*age_prop * See DHS Guide to Statistics for use of 2.4 rather than 2.5 in the following formula gen q5=5*mx/(1+2.4*mx) gen qterm=log(1-q5) save age_specific_results.dta, replace * save some numbers for the calculation of the standard errors * must add 7 to the index because the first 7 elements are for men (and are NA) local li=1 while `li'<=7 { local liplus7=`li'+7 scalar dprmx`li'=prmx_rewtd[`liplus7'] scalar dmmx`li'=mmx_rewtd[`liplus7'] scalar dfx`li' =fx_rewtd[`liplus7'] local li=`li'+1 } local lcid=scid local lpv=spv local llw=lw local luw=uw gen str2 country=scid gen str2 phase_version=spv gen lw=lw gen uw=uw gen refdate=refdate gen mean_doi=mean_doi save "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort_by_age.dta", replace * save a version without the identifiers save "adult_mat_mort_by_age.dta", replace #delimit ; * adult mortality list sex age_grp unwtd_deaths unwtd_yexp wtd_deaths wtd_yexp mx q5, table clean; export excel country phase_version lw uw refdate mean_doi sex age_grp age_prop unwtd_deaths unwtd_yexp wtd_deaths wtd_yexp mx using "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort.xlsx", firstrow(variable) sheet("Adult mortality by age") sheetreplace ; export excel country phase_version lw uw refdate mean_doi sex age_grp age_prop prpmdf unwtd_prdeaths wtd_prdeaths wtd_yexp prmx fx using "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort.xlsx", firstrow(variable) sheet("PR mortality by age") sheetreplace; export excel country phase_version lw uw refdate mean_doi sex age_grp age_prop mpmdf unwtd_mdeaths wtd_mdeaths wtd_yexp mmx fx using "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort.xlsx", firstrow(variable) sheet("Maternal mortality by age") sheetreplace; * pregnancy related mortality; list sex age_grp prpmdf unwtd_prdeaths wtd_prdeaths wtd_yexp prmx fx q5 if sex==2, table clean abbreviate(20); * maternal mortality; list sex age_grp mpmdf unwtd_mdeaths wtd_mdeaths wtd_yexp mmx fx q5 if sex==2, table clean abbreviate(20); #delimit cr * Calculate the summary rates as the totals of the columns in work.dta; rename the sums collapse (first) country phase_version lw uw refdate mean_doi (sum) *wtd_*deaths *wtd_yexp *mx_rewtd fx* qterm (mean) sex_prop, by(sex) rename fx_rewtd GFR_rewtd rename mx_rewtd Drate_rewtd rename prmx_rewtd PRMRate_rewtd rename mmx_rewtd MMRate_rewtd gen PRMRatio=PRMRate_rewtd/GFR_rewtd gen MMRatio=MMRate_rewtd/GFR_rewtd gen TFR=5*fx drop fx * Calculate the PMDF, all-cause death rates for men and women (35m15), and the probabilities (35q15) gen prPMDF=wtd_prdeaths/wtd_deaths gen mPMDF=wtd_mdeaths/wtd_deaths gen q_15_to_50=1-exp(qterm) drop qterm * two versions of the LTR; In LTR2 the factor 16.7 is an approximation from another source gen prLTR1=1-(1-PRMRatio)^TFR gen prLTR2=(35-16.7*q_15_to_50)*PRMRate_rewtd gen mLTR1=1-(1-MMRatio)^TFR gen mLTR2=(35-16.7*q_15_to_50)*MMRate_rewtd * Calculate confidence intervals for the age-adjusted death rates, * Extract scalars for ci calculation * To avoid / reduce ambiguity between variables and scalars, use s for first letter of a scalar scalar sDrate_men_rewtd=Drate_rewtd[1] scalar sDrate_women_rewtd=Drate_rewtd[2] scalar sPRMRate_rewtd=PRMRate_rewtd[2] scalar sMMRate_rewtd=MMRate_rewtd[2] scalar sGFR_rewtd=GFR_rewtd[2] scalar sPRMRatio=PRMRatio[2] scalar sMMRatio=MMRatio[2] calc_ci gen Drate_rewtd_L =. gen Drate_rewtd_U =. gen PRMRate_rewtd_L=. gen PRMRate_rewtd_U=. gen MMRate_rewtd_L =. gen MMRate_rewtd_U =. gen GFR_rewtd_L =. gen GFR_rewtd_U =. gen PRMRatio_L =. gen PRMRatio_U =. gen MMRatio_L =. gen MMRatio_U =. replace Drate_rewtd_L=sDrate_men_rewtd_L if sex==1 replace Drate_rewtd_U=sDrate_men_rewtd_U if sex==1 replace Drate_rewtd_L=sDrate_women_rewtd_L if sex==2 replace Drate_rewtd_U=sDrate_women_rewtd_U if sex==2 replace PRMRate_rewtd_L=sPRMRate_rewtd_L if sex==2 replace PRMRate_rewtd_U=sPRMRate_rewtd_U if sex==2 replace MMRate_rewtd_L=sMMRate_rewtd_L if sex==2 replace MMRate_rewtd_U=sMMRate_rewtd_U if sex==2 replace GFR_rewtd_L =sGFR_rewtd_L if sex==2 replace GFR_rewtd_U =sGFR_rewtd_U if sex==2 replace PRMRatio_L =sPRMRatio_L if sex==2 replace PRMRatio_U =sPRMRatio_U if sex==2 replace MMRatio_L =sMMRatio_L if sex==2 replace MMRatio_U =sMMRatio_U if sex==2 list sex lw uw unwtd_deaths unwtd_yexp wtd_deaths wtd_yexp Drate_rewtd* q_15_to_50, table clean list sex lw uw unwtd_prdeaths wtd_prdeaths prPMDF PRMRate_rewtd* GFR_rewtd* PRMRatio* prLTR* if sex==2, table clean list sex lw uw unwtd_mdeaths wtd_mdeaths mPMDF MMRate_rewtd* GFR_rewtd* MMRatio* mLTR* if sex==2, table clean export excel using "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort.xlsx", firstrow(variable) sheet("Mortality summary") sheetreplace save "`lcid'`lpv'_`llw'_`luw'_adult_mat_mort.dta", replace * save a version without the identifiers save "adult_mat_mort.dta", replace end *************************************************************************** program define main_adult_mm_mortality scalar scid=substr(sfn_IR,1,2) scalar spv =substr(sfn_IR,5,2) local lpath_results=spath_results cd `lpath_results' * You can put "quietly" in front of any of these subroutine calls setup_adult_mm_vars sibship_size_and_sex_ratio completeness_of_information get_age_distributions *quietly get_exposure_and_deaths get_exposure_and_deaths calc_mortality_rates main_GFR_for_mm merge_files * optional--erase the working files erase births.dta erase exposure_and_deaths.dta erase exposure.dta erase exposure_and_births.dta erase adult_mm_vars.dta erase age_dist_f.dta erase age_dist_m.dta erase sex_age_dist.dta erase workfile.dta *erase micro.dta erase IR_all_women.dta end *************************************************************************** *************************************************************************** *************************************************************************** *************************************************************************** *************************************************************************** *************************************************************************** *************************************************************************** *************************************************************************** * EXECUTION BEGINS HERE /* THIS IS WHERE YOU IDENTIFY THE PATHS, INPUT FILES, AND TIME INTERVAL FOR THE RATES Specify the interval or window for the rates with two scalars. When counting backwards, the month of interview is month 0 and is never included. The normal specification is for years 0-6 before the survey, i.e. 7 years. For this, set scalar lw=-6 and uw=0. "l" for lower, "u" for upper, "w" for window. The conversion to sibling-specific start_month and end_month is done in start_month_end_month. Include lines to give the paths to the IR and MR files for the surveys you want to use, as scalars. Keep these lines for examples.... scalar lw=-6 scalar uw=-0 scalar spath="C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata" scalar spath="C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata" scalar sfn_IR="KHIR72FL.dta" scalar sfn_MR="KHMR71FL.dta" This version does not include the data on the men's siblings, if any. Modification to do that is not difficult. Here the men's file is used only as part of the calculation of adult male mortality, not for maternal mortality. If you are not interested in adult male mortality, you can use any MR file at all, with no effect on the estimates of adult female or maternal mortality. Factors of 1000 or 100,000 are not included in the output and numbers are not rounded. You can repeat any of the following specifications of the time interval, paths, and data files, followed by "main_adult_mm_mortality", for multiple runs on the same file or different files. You do not need to re-specify a path, data file, or time interval if they would not change. Each set of specifications will produce a different set of output files. */ ******************************* * Specify the path to the log file and the output files and give a name to the log file. * Several working files will be sent to this folder and then erased. scalar spath_results="e:\DHS\programs\unified_rates" local lpath_results=spath_results * set logtype text *log using "`lpath_results'\\DHS_adult_and_maternal_mortality_log_12Oct2020.txt",replace ******************************* ******************************* * Specify the time interval; modify lw and uw as needed scalar lw=-6 scalar uw=-0 ******************************* ******************************* * Specify path(s) to the data files scalar spath="C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata" *scalar spath="e:\DHS\DHS_data\Liberia" ******************************* ******************************* * Specify the names of the data files scalar sfn_IR="LBIR70FL.dta" scalar sfn_MR="LBMR70FL.dta" scalar sfn_PR="LBPR70FL.dta" ******************************* ******************************* * Specify the names of the data files scalar sfn_IR="NGIR7BFL.dta" scalar sfn_MR="NGMR7AFL.dta" scalar sfn_PR="NGPR7BFL.dta" ******************************* * include a special scalar to identify surveys for which v023 is not the stratum variable scalar sv023_NA=0 *scalar sv023_NA=1 ******************************* * The path and name of the PR file are only needed if the standard age distribution of men will * come from the PR file rather than the MR file ******************************* * Execute the program main_adult_mm_mortality * After this program has been run and the files have been saved you can run another program * that reads the saved "adult_mat_mort_by_age.dta" and "adult_mat_mort.dta" files and outputs the * various rates etc. in a format that is more like the tables at the end of the main report * chapter on adult and maternal mortality. ****************************************************************************** * END OF PROGRAM