2

I am working with survey data and trying to figure out how to calculate the overall prevalence of diabetes, prevalence of diabetes by gender and by race. I know that I can get the prevalence of diabetes by gender and by race with the following sas code and looking at the row percent in the output.

Is this correct?

proc surveyfreq data= 
strata name  ; 
tables gender/race * diabetes / row; 
weight name; 
run; 

Also, where do I look, in the output, to find the overall prevalence of diabetes?

flag

2 Answers

2

You should specify the survey design (stratum variables, cluster variables [if any], and respondent sampling weight variables) in your PROC SURVEYFREQ "paragraph". Before running PROC SURVEYFREQ, sort your data by the stratum variables and the cluster variables.

Your syntax also uses the same variable, NAME, for the stratum variable and for the respondent weight variable. This is somewhat unusual, and I would recheck the variables on your data set to be sure that this is correct.

This is how I'd change your syntax:

  proc sort data=abc;
    by name [clustervar, if any];
  run;

  proc surveyfreq data=abc missing;
    strata name / list;
    [cluster clustervar];
    weight respwt;
    tables (gender race gender*race) * diabetes / row col cl nostd; 
  run; 

The MISSING option of the PROC SURVEYFREQ statement considers missing values of strata, cluster variables, and categorical variables in the TABLE statement as valid categories for calculating percentages. This is useful in determining how missing values might affect the estimates.

The TABLES statement includes tables for gender-by-diabetes, race-by-diabetes, and gender-by-race-by-diabetes. Both the row percentages and the column percentages for these tables are estimated (the ROW and the COL options) as well as 95% confidence limits for these percentages (the CL option). Once these confidence limits are estimated, the standard errors for the percentages are less helpful (omitted using the NOSTD option).

link|flag
0

Could you post a sample of your data so we can see how it's structured?

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.