The FREQ Procedure |
OUTPUT Statement |
The OUTPUT statement creates a SAS data set that contains statistics computed by PROC FREQ. You specify which statistics to store in the output data set with the OUTPUT statement options. The output data set contains one observation for each two-way table or stratum, and one observation for summary statistics across all strata. For more information about the contents of the output data set, see the section Contents of the OUTPUT Statement Output Data Set.
Only one OUTPUT statement is allowed for each execution of PROC FREQ. You must specify a TABLES statement with the OUTPUT statement. If you use multiple TABLES statements, the contents of the OUTPUT data set correspond to the last TABLES statement. If you use multiple table requests in a TABLES statement, the contents of the OUTPUT data set correspond to the last table request.
Note that you can use the Output Delivery System (ODS) to create a SAS data set from any piece of PROC FREQ output. For more information, see the section ODS Table Names.
Also note that the output data set created by the OUTPUT statement is not the same as the output data set created by the OUT= option in the TABLES statement. The OUTPUT statement creates a data set that contains statistics (such as the Pearson chi-square and its p-value), and the OUT= option in the TABLES statement creates a data set that contains frequency table counts and percentages. See the section Output Data Sets for more information.
You can specify the following options in an OUTPUT statement:
names the output data set. If you omit the OUT= option, the data set is named DATAn, where n is the smallest integer that makes the name unique.
specify the statistics you want in the output data set. Table 3.7 lists the available options, together with the TABLES statement options needed to produce the statistics. You can output groups of statistics by using group options identical to those available in the TABLES statement, which include the AGREE, ALL, CHISQ, CMH, and MEASURES options. Or you can request statistics individually.
When you specify an option in the OUTPUT statement, the output data set contains all statistics from that analysis—the estimate or test statistic plus any associated standard error, confidence limits, p-values, and degrees of freedom. See the section Contents of the OUTPUT Statement Output Data Set for details.
If you want to store a statistic in the output data set, you must also request computation of that statistic with the appropriate TABLES or EXACT statement option. For example, you cannot specify the option PCHI (Pearson chi-square) in the OUTPUT statement without also specifying a TABLES or EXACT statement option to compute the Pearson chi-square test. The TABLES statement option ALL or CHISQ requests the Pearson chi-square test. If you have only one TABLES statement, the EXACT statement option CHISQ or PCHI also requests the Pearson chi-square test. Table 3.7 lists the TABLES statement options required to produce the OUTPUT data set statistics. Note that the ALL option in the TABLES statement invokes the CHISQ, MEASURES, and CMH options.
Option |
Output Data Set Statistics |
Required TABLES Statement Option |
---|---|---|
McNemar’s test, Bowker’s test, simple and |
||
weighted kappas; for multiple strata, overall |
||
simple and weighted kappas, tests for equal |
||
kappas, and Cochran’s |
||
Continuity-adjusted chi-square ( tables) |
||
CHISQ, MEASURES, and CMH statistics; N |
||
Breslow-Day test ( tables) |
||
Binomial statistics for one-way tables |
||
For one-way tables, goodness-of-fit test; |
||
for two-way tables, Pearson, likelihood-ratio, |
||
continuity-adjusted, and Mantel-Haenszel |
||
chi-squares, Fisher’s exact test ( tables), |
||
phi and contingency coefficients, Cramer’s |
||
Cochran-Mantel-Haenszel (CMH) correlation, |
||
row mean scores (ANOVA), and general |
||
association statistics; for tables, logit and |
||
Mantel-Haenszel adjusted odds ratios and |
||
relative risks, Breslow-Day test |
||
CMH output, except row mean scores (ANOVA) |
||
and general association statistics |
||
CMH output, except general association statistic |
||
CMH correlation statistic |
||
CMH general association statistic |
||
CMH row mean scores (ANOVA) statistic |
||
Cochran’s ( tables) |
||
Contingency coefficient |
||
Cramer’s |
||
Test for equal simple kappas |
||
Zelen’s test for equal odds ratios ( tables) |
CMH and EXACT EQOR |
|
Test for equal weighted kappas |
||
Fisher’s exact test |
||
Gail-Simon test |
||
Gamma |
||
Jonckheere-Terpstra test |
||
Simple kappa coefficient |
||
Kendall’s tau- |
||
Lambda asymmetric |
||
Lambda symmetric |
||
Lambda asymmetric |
||
Adjusted logit odds ratio ( tables) |
||
Adjusted column 1 logit relative risk |
||
Adjusted column 2 logit relative risk |
||
Likelihood-ratio chi-square |
||
McNemar’s test ( tables) |
||
Gamma, Kendall’s tau-, Stuart’s tau-, |
||
Somers’ and , Pearson and |
||
Spearman correlations, lambda asymmetric |
||
and , lambda symmetric, |
||
uncertainty coefficients and , |
||
symmetric uncertainty coefficient; |
||
odds ratio and relative risks ( tables) |
||
Mantel-Haenszel chi-square |
||
Adjusted Mantel-Haenszel odds ratio |
||
( tables) |
||
Adjusted column 1 Mantel-Haenszel relative risk |
||
Adjusted column 2 Mantel-Haenszel relative risk |
||
Number of nonmissing observations |
||
Number of missing observations |
||
Odds ratio ( tables) |
||
Chi-square goodness-of-fit test for one-way tables, |
||
Pearson chi-square for two-way tables |
||
Pearson correlation coefficient |
||
Phi coefficient |
||
Polychoric correlation coefficient |
||
Column 1 risk difference (row 1 - row 2) |
||
Column 2 risk difference (row 1 - row 2) |
||
Odds ratio and relative risks ( tables) |
||
Risks and risk differences ( tables) |
||
Column 1 risks and risk difference |
||
Column 2 risks and risk difference |
||
Column 1 relative risk |
||
Column 2 relative risk |
||
Column 1 risk, overall |
||
Column 1 risk, for row 1 |
||
Column 2 risk, for row 1 |
||
Column 2 risk, overall |
||
Column 1 risk, for row 2 |
||
Column 2 risk, for row 2 |
||
Spearman correlation coefficient |
||
Somers’ |
||
Somers’ |
||
Stuart’s tau- |
||
Cochran-Armitage test for trend |
||
Bowker’s test of symmetry |
||
Symmetric uncertainty coefficient |
||
Uncertainty coefficient |
||
Uncertainty coefficient |
||
Weighted kappa coefficient |
Copyright © SAS Institute, Inc. All Rights Reserved.