Hi,
I'm trying to calculate age-standardized incidence rates, but I must have made mistakes in my code cause it's doesn't work.
I want to calculate the incidence for the people who are sick (variable RESULT which is coded 0 if it's negative and 1 if it's positive) and that this incidence be age-standardized (reference population is Fr.dta)
This is what I did :
However, for the last line (function dstdizedstdize RESULT POPULATION AGECL, by(byVar) using(Fr.dta) print) it say : "RESULT must be <= POPULATION"
Do you know how I can solve this ?
I'm trying to calculate age-standardized incidence rates, but I must have made mistakes in my code cause it's doesn't work.
I want to calculate the incidence for the people who are sick (variable RESULT which is coded 0 if it's negative and 1 if it's positive) and that this incidence be age-standardized (reference population is Fr.dta)
This is what I did :
Code:
gen POPULATION=1 generate AGECL = . replace AGECL = 1 if AGE1>=0 & AGE1<=14 replace AGECL = 2 if AGE1>=15 & AGE1<=29 replace AGECL = 3 if AGE1>=30 & AGE1<=44 replace AGECL = 4 if AGE1>=45 & AGE1<=59 replace AGECL = 5 if AGE1>=60 & AGE1<=74 replace AGECL = 6 if AGE1>=75 label var AGECL "age classes" label define AGECL_label 1 "0-14" 2 "15-29" 3 "30-44" 4 "45-59" 5 "60-74" 6 "75+" label values AGECL AGECL_label save Prev.dta input AGECL POPULATION 1 11965004 2 11740895 3 12486039 4 13345975 5 11133961 6 6286470 end label values AGECL AGECL label def AGECL 1 "0-14", modify label def AGECL 2 "15-29", modify label def AGECL 3 "30-44", modify label def AGECL 4 "45-59", modify label def AGECL 5 "60-74", modify label def AGECL 6 "75+", modify label var AGECL "Age classes" label var POPULATION "Age-group population in France" format POPULATION %14.2f egen double pct= total(POPULATION) replace pct= (POPULATION/pct)*100 gen cum_pct=sum(pct) l, sep(0) table AGECL, c (min pct) format (%14.2f) save Fr.dta, replace use Prev.dta merge m:1 AGECL using Fr.dta gen byVar=1 dstdize RESULT POPULATION AGECL, by(byVar) using(Fr.dta) print
Do you know how I can solve this ?