* Replication of Table 3.4, Age at First Marriage, in the India 1998-99 DHS (NFHS-2) set more off use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAIR42FL.dta" , clear log using e:\DHS\programs\age_at_first_marriage\age_at_first_marriage_NFHS-2_do_6June2018, replace drop if v024==35 numlabel,add tab v503,m gen afm=. replace afm=s114 if v503==1 replace afm=s111 if v503==2 * everyone should have an afm that is less than or equal to their current age replace afm=. if afm>v012 svyset v021 [pweight=v005], strata(v022) singleunit(centered) gen awfactt_100=awfactt/100 gen awfactu_100=awfactu/100 * Begin a loop through all six cutoff ages (columns of the table) local cutoff_age 13 15 18 20 22 25 foreach lage of local cutoff_age { scalar cutoff_age=`lage' if cutoff_age==13 | cutoff_age==15 { scalar sv013min=1 } scalar cutoff_age=`lage' if cutoff_age==18 | cutoff_age==20 { scalar sv013min=2 } scalar cutoff_age=`lage' if cutoff_age==22 | cutoff_age==25 { scalar sv013min=3 } gen M`lage'=0 replace M`lage'=100 if afm<`lage' replace M`lage'=0 if afm>49 * For each cutoff age, calculate the urban, rural, and total panels by current age scalar place_of_residence="Urban" scalar list cutoff_age place_of_residence svy: ratio M`lage'/awfactu_100 if v013>=sv013min & v025==1, over(v013) scalar place_of_residence="Rural" scalar list cutoff_age place_of_residence svy: ratio M`lage'/awfactu_100 if v013>=sv013min & v025==2, over(v013) scalar place_of_residence="Total" scalar list cutoff_age place_of_residence svy: ratio M`lage'/awfactt_100 if v013>=sv013min, over(v013) }