Chapter Contents

Previous

Next
The FREQ Procedure

Example 4: Analyzing a 2×2 Contingency Table


Procedure features:
PROC FREQ statement option:
ORDER=
EXACT statement
TABLES statement options:
CHISQ
RELRISK
WEIGHT statement
Other features:
FORMAT procedure
SORT procedure

This example


Program

options nodate pageno=1 linesize=84 pagesize=64;
 Note about code
proc format;
   value expfmt 1='High Cholesterol Diet'
                0='Low Cholesterol  Diet';
   value rspfmt 1='Yes'
                0='No';
run;
 Note about code
data fatcomp;
   input Exposure Response Count;
   label response='Heart Disease';
   datalines;
0 0 6
0 1 2
1 0 4
1 1 11
;
 Note about code
proc sort data=fatcomp;
   by descending exposure descending response;
run;
 Note about code
proc freq data=fatcomp order=data;
   weight count;
 Note about code
   tables exposure*response / chisq relrisk;
 Note about code
   exact pchi or;
 Note about code
   format exposure expfmt. response rspfmt.;
   title 'Case-Control Study of High Fat/Cholesterol Diet';
run;


Output
The contingency table lists the variable values so that the first table cell contains the frequency of positive exposure and response. PROC FREQ does not truncate the formatted variable values that are more than 16 characters but uses multiple lines to show Exposure levels.

PROC FREQ displays a warning message that sample size requirements may not be met for the asymptotic chi-square tests. The exact tests are appropriate when sample size is small.

Because the alternative hypothesis for this analysis states that coronary heart disease was more likely to be associated with a high-fat diet, a one-sided test is needed. Fisher's exact test (right-sided) tests that the probability of heart disease in the high-fat group exceeds the probability of heart disease in the low-fat group.

The odds ratio, which provides an estimate of the relative risk when an event is rare, indicates that the odds of heart disease are 8.25 times higher in the high fat diet group. However, the wide confidence limits indicate that this estimate has low precision.

[HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.