Chapter Contents |
Previous |
Next |
The FREQ Procedure |
PROC FREQ does not display the output data sets. Use PROC PRINT, PROC REPORT, or any other SAS reporting tool to display an output data set.
If you specify the OUTEXPECT and OUTPCT options in the TABLES statement, the output data set also contains expected frequencies and row, column, and table percentages, respectively. The additional variables are
When you submit the following statements
proc freq; tables A A*B / out=D; run;the output data set D contains frequencies and percentages for the last table request, A*B. If A has two levels (1 and 2), B has three levels (1,2, and 3), and no table cell count is zero or missing, the output data set D includes six observations, one for each combination of A and B. The first observation corresponds to A=1 and B=1; the second observation corresponds to A=1 and B=2; and so on. The data set includes the variables COUNT and PERCENT. The value of COUNT is the number of observations with the given combination of A and B values. The value of PERCENT is the percent of the total number of observations having that A and B combination.
When PROC FREQ combines different variable values into the same formatted level, the output data set contains the smallest internal value for the formatted level. For example, suppose a variable X has the values 1.1., 1.4, 1.7, 2.1, and 2.3. When you submit the statement
format X 1.;in a PROC FREQ step, the formatted levels listed in the frequency table for X are 1 and 2. If you create an output data set with the frequency counts, the internal values of X are 1.1 and 1.7. To report the internal values of X when you display the output data set, use a format of 3.1 with X.
The OUTPUT data set can include the following variables.
The output data set also includes variables with the p-values and degrees of freedom, asymptotic standard error (ASE), or confidence limits when PROC FREQ computes these values for a specified statistic.
The variable names for the specified statistics in the output data set are the names of the options enclosed in underscores. PROC FREQ forms variable names for the corresponding p-values, degrees of freedom, or confidence limits by combining the name of the option with the appropriate prefix from the following list:
DF_ | degrees of freedom |
E_ | asymptotic standard error (ASE) |
L_ | lower confidence limit |
U_ | upper confidence limit |
E0_ | ASE under the null hypothesis |
Z_ | standardized value |
P_ | p-value |
P2_ | two-sided p-value |
PL_ | left-sided p-value |
PR_ | right-sided p-value |
XP_ | exact p-value |
XP2_ | exact two-sided p-value |
XPL_ | exact left-sided p-value |
XPR_ | exact right-sided p-value |
XL_ | exact lower confidence limit |
XR_ | exact upper confidence limit |
For example, variable names created for the Pearson chi-square, its degrees of freedom, its p-values are _PCHI_, DF_PCHI, and P_PCHI, respectively.
If the length of the prefix plus the statistic option exceeds eight characters, PROC FREQ truncates the option so that the name of the new variable is eight characters long.
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.