Hi,
I am looking for sas codes to calculate age standardized prevalence.
Data: cross sectional data.
I have calculated the prevalence of body mass index (four categories) and about 10 other categorical variables like the BMI (alcohol use, smoking etc.) by sex (male and female). I used proc frequency and chi-square test to compare prevalence of BMI and the differences of each variable by sex.
However, now I have been asked to do a age standardized prevalence and compare differences by sex. I can calculate the age adjusted prevalence by hand using the population standard age structure (census 2000 US population) but don't know how to do it in sas.
I found an article https://www.cdc.gov/nchs/tutorials/NHANES/NHANESAnalyses/AgeStandardization/Task1b_SAS92.htm but it was not helpful. I appreciate your help.
Thank you
Best regards,
Akemi
Use PROC STDIZE.
/*This program illustrates how to age standardize rates using the age data for Canada 1991*/
*Source Data:http://www.apheo.ca/resources/indicators/Standardization%20report_NamBains_FINALMarch16.pdf
*Source Code:http://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_stdrate_syntax01.htm
;
*Create dataset with Canada Standard Rates for 1991;
data CanadaSTDRATE;
format AgeGroup 2. AgeGroupDesc $5. Canada1991 comma12.;
informat Canada1991 comma12.;
input AgeGroup AgeGroupDesc $ Canada1991;
cards;
1 0-4 1,953,346
2 5-9 1,953,045
3 10-14 1,913,115
4 15-19 1,926,090
5 20-24 2,109,452
6 25-29 2,529,239
7 30-34 2,598,289
8 35-39 2,344,872
9 40-44 2,138,891
10 45-49 1,674,153
11 50-54 1,339,902
12 55-59 1,238,441
13 60-64 1,190,217
14 65-69 1,084,588
15 70-74 834,024
16 75-79 622,221
17 80-84 382,303
18 85-89 192,410
19 90+ 95,467
;
run;
*Create sample data set with raw event numbers and population numbers;
data study_data;
format AgeGroup 8. events population comma12.;
input AgeGroup events population;
cards;
1 37 756055
2 25 760339
3 23 740079
4 27 721396
5 47 747171
6 66 826426
7 122 994837
8 264 973239
9 443 865317
10 731 790269
11 1022 608638
12 1523 501218
13 2223 459365
14 3108 431223
15 3866 374246
16 3345 255754
17 2719 167495
18 1692 85585
19 906 42224
;
run;
*Example of standardization rates;
*Expected value out is 187.1 95% CI(184.7, 189.1);
ods table STDRATE=EX_STDRATE; /*Store results in dataset if needed*/
proc stdrate data=study_data /*Specify data that contains events and population*/
refdata=CanadaSTDRATE /*Specify dataset that contains reference population*/
method=direct /*Specify the method of standardizaton*/
stat=rate (mult=100000) /*Specify that the stat of interest is Rate(vs Risk) and per 100,000 population*/
CL=Normal /*Specify the type of CI required - Gamma, lognormal, none, normal, poisson*/
;
population event=events total=population; /*Specify variables from event data*/
reference total=Canada1991; /*Specify the population variable from the reference data*/
strata agegroup; /*Specify the category (ie age group)*/
run;
*If needed to run this for multiple diseases at once, ADD GROUP=VARIABLE to the population statement. This won’t run, I don’t have sample data for it;
proc stdrate data=study_data /*Specify data that contains events and population*/
refdata=CanadaSTDRATE /*Specify dataset that contains reference population*/
method=direct /*Specify the method of standardizaton*/
stat=rate (mult=100000) /*Specify that the stat of interest is Rate(vs Risk) and per 100,000 population*/
;
population group=DISEASE event=events total=population; /*Specify variables from event data and BY GROUP, where you need a different rate for each group*/
reference total=Canada1991; /*Specify the population variable from the reference data*/
strata agegroup; /*Specify the category (ie age group)*/
run;
@Akemi25 wrote:
Hi,
I am looking for sas codes to calculate age standardized prevalence.
Data: cross sectional data.
I have calculated the prevalence of body mass index (four categories) and about 10 other categorical variables like the BMI (alcohol use, smoking etc.) by sex (male and female). I used proc frequency and chi-square test to compare prevalence of BMI and the differences of each variable by sex.
However, now I have been asked to do a age standardized prevalence and compare differences by sex. I can calculate the age adjusted prevalence by hand using the population standard age structure (census 2000 US population) but don't know how to do it in sas.
I found an article https://www.cdc.gov/nchs/tutorials/NHANES/NHANESAnalyses/AgeStandardization/Task1b_SAS92.htm but it was not helpful. I appreciate your help.
Thank you
Best regards,
Akemi
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.