clear set more off ************************************************ * Reference: * A.J. Silman and G.J. Macfarlane (2002) * Epidemiological Studies. 2nd edition * Cambridge University Press * pagg. 163 - 167 ************************************************ ************************************************ * Example 16.viii Direct age-standardisation ************************************************ input str8 city age x npyr Hightown 1 10 9415 Hightown 2 18 8346 Hightown1 3 20 6215 Hightown1 4 22 2196 Lowtown 1 3 4103 Lowtown 2 6 3765 Lowtown 3 12 4192 Lowtown 4 73 7426 end label define age 1 "0-15" 2 "16-34" 3 "35-64" 4 "65+" label values age age * Direct standardisation dstdize x npyr age, by(city) base("Hightown") ************************************************ * Example 16.ix Indirect age-standardisation ************************************************ * Define Hightown as the 'standard' population * Save it in the std_pop.dta data set clear input age x_stdpop npyr_stdpop 1 10 9415 2 18 8346 3 20 6215 4 22 2196 end compress save std_pop.dta, replace * Input data about Lowtown clear input age x1 npyr1 1 3 4103 2 6 3765 3 12 4192 4 73 7426 end label define age 1 "0-15" 2 "16-34" 3 "35-64" 4 "65+" label values age age * Indirect standardisation istdize x1 npyr1 age using std_pop, print popvars(x_stdpop npyr_stdpop)