* do e:\DHS\programs\high_risk_fertility_do_22Apr2019.txt set more off *use e:\DHS\DHS_data\KR_files\NGKR6AFL.dta, clear use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\KHKR73FL.DTA" , clear * Check the total number of weighted cases tab b5 [iweight=v005/1000000] gen age_of_mother=int((b3-v011)/12) * Adjustment for multiple births to give the same order as that of the first in multiples; * b0 is sequence in the multiple birth IF part of a multiple birth; b0=0 if not a multiple birth; * only shift the second (or later) birth within a multiple birth. gen bord_adj=bord *replace bord_adj=bord-1 if b0==2 *replace bord_adj=bord-2 if b0==3 replace bord_adj=bord-b0+1 if b0>1 * Single risk categories, initial definition * Four basic criteria gen young=0 gen old=0 gen soon=0 gen many=0 replace young=1 if age_of_mother<18 replace old=1 if age_of_mother>34 replace soon=1 if b11<24 replace many=1 if bord_adj>3 gen unavoidable_risk=0 replace unavoidable_risk=1 if bord_adj==1 & young==0 & old==0 * Construct the four single-risk categories gen too_young=0 gen too_old=0 gen too_soon=0 gen too_many=0 replace too_young=1 if young==1 & old==0 & soon==0 & many==0 replace too_old =1 if young==0 & old==1 & soon==0 & many==0 replace too_soon =1 if young==0 & old==0 & soon==1 & many==0 replace too_many =1 if young==0 & old==0 & soon==0 & many==1 * Pooling of single risk categories gen single_risk=0 replace single_risk=1 if too_young+too_old+too_soon+too_many>0 * Construct the five multiple-risk categories gen too_young_too_soon=0 gen too_old_too_soon=0 gen too_old_too_many=0 gen too_old_too_soon_too_many=0 gen too_soon_too_many=0 replace too_young_too_soon =1 if young==1 & old==0 & soon==1 & many==0 replace too_old_too_soon =1 if young==0 & old==1 & soon==1 & many==0 replace too_old_too_many =1 if young==0 & old==1 & soon==0 & many==1 replace too_old_too_soon_too_many=1 if young==0 & old==1 & soon==1 & many==1 replace too_soon_too_many =1 if young==0 & old==0 & soon==1 & many==1 * Pooling of multiple risk categories gen multiple_risk=0 replace multiple_risk=1 if too_young_too_soon+too_old_too_soon+too_old_too_many+too_old_too_soon_too_many+too_soon_too_many >0 * Pooling of any avoidable risk gen any_avoidable_risk=0 replace any_avoidable_risk=1 if single_risk+multiple_risk>0 * No risk is the residual gen no_risk=0 replace no_risk=1 if unavoidable_risk==0 & any_avoidable_risk==0 * Give results format %6.3f too* single* multiple* any* un* no* mean no un too* single* multiple* any [iweight=v005/1000000] * If you want confidence intervals, use prop and look at the lines for the value 1; make survey adjustments *prop no un too* single* multiple* any [iweight=v005/1000000] * The following section gives the risk ratios. Need to add the other risk categories to the local..... local risk_categories unavoidable_risk too_young too_old too_soon too_many proportion b5 if no_risk==1 [iweight=v005/1000000] matrix T=r(table) scalar denom=T[1,1] quietly foreach lcat of local risk_categories { proportion b5 if `lcat'==1 [iweight=v005/1000000] matrix T=r(table) scalar num=T[1,1] scalar risk_ratio_`lcat'=round(num/denom,.01) } foreach lcat of local risk_categories { scalar list risk_ratio_`lcat' }