![]() Chapter Contents |
![]() Previous |
![]() Next |
The FREQ Procedure |
In order to test the hypothesis for each region, the data
are first sorted by Region. Then the FREQ procedure
uses a BY statement to produce a separate table for each BY
group (Region). The option ORDER=DATA orders the
frequency table values (hair color) by their order in the
data set. The TABLES statement requests a frequency table
for hair color, and the option NOCUM suppresses the display
of the cumulative frequencies and percentages. The TESTP=
option specifies the hypothesized percentages for the
chi-square test; the number of percentages specified equals
the number of table levels, and the percentages sum to 100.
The following statements produce Output 28.2.1.
proc sort data=Color; by Region; run; proc freq data=Color order=data; weight Count; tables Hair/nocum testp=(30 12 30 25 3); by Region; title 'Hair Color of European Children'; run;Output 28.2.1: One-way Frequency Table with BY Group
|
The frequency tables list the variable values (hair color) in the order in which they appear in the data set. The "Test Percent" column lists the hypothesized percentages for the chi-square test. Always check that you have ordered the TESTP= percentages to correctly match the order of the variable levels.
PROC FREQ computes a chi-square statistic for each region. The chi-square statistic is significant at the 0.05 level for Region 2 (p=0.0003) but not for Region 1. This indicates a significant departure from the hypothesized percentages in Region 2.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.