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 35.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 35.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 |
||
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 © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.