Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The FREQ Procedure

OUTPUT Statement

OUTPUT < OUT= SAS-data-set > options ;

The OUTPUT statement creates a SAS data set containing statistics computed by PROC FREQ. The variables contain statistics for each two-way table or stratum, as well as summary statistics across all strata.

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.

For more information, see the section "Output Data Sets".

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 Table 28.11 and Chapter 15, "Using the Output Delivery System."

You can specify the following options in an OUTPUT statement.

OUT=SAS-data-set
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.


options
specifies the statistics that you want in the output data set. Available statistics are those produced by PROC FREQ for each one-way or two-way table, as well as the summary statistics across all strata. When you request a statistic, the OUTPUT data set contains that estimate or test statistic plus any associated standard error, confidence limits, p-values, and degrees of freedom. You can output statistics by using group options identical to those specified in the TABLES statement: AGREE, ALL, CHISQ, CMH, and MEASURES. Alternatively, you can request an individual statistic by specifying one of the options shown in the following table.

Table 28.7: OUTPUT Statement Options and Required TABLES Statement Options
Option Output Data Set Statistics Required TABLES Statement Option
AGREE McNemar's test for 2 ×2 tables, simple kappa coefficient, and weighted kappa coefficient; for square tables with more than two response categories, Bowker's test of symmetry; for multiple strata, overall simple and weighted kappa statistics, and tests for equal kappas among strata; for multiple strata with two response categories, Cochran's Q testAGREE
AJCHI continuity-adjusted chi-square for 2 ×2 tablesALL or CHISQ
ALL all statistics under CHISQ, MEASURES, and CMH, and the number of nonmissing subjectsALL
BDCHI Breslow-Day testALL or CMH or CMH1 or CMH2
BIN | BINOMIAL for one-way tables, binomial proportion statisticsBINOMIAL
CHISQ chi-square goodness-of-fit test for one-way tables; for two-way tables, Pearson chi-square, likelihood-ratio chi-square, continuity-adjusted chi-square for 2 ×2 tables, Mantel-Haenszel chi-square, Fisher's exact test for 2 ×2 tables, phi coefficient, contingency coefficient, and Cramer's VALL or CHISQ
CMH Cochran-Mantel-Haenszel correlation, row mean scores (ANOVA), and general association statistics; for 2 ×2 tables, logit and Mantel-Haenszel adjusted odds ratios, relative risks, and Breslow-Day testALL or CMH
CMH1 same as CMH, but excludes general association and row mean scores (ANOVA) statisticsALL or CMH or CMH1
CMH2 same as CMH, but excludes the general association statisticALL or CMH or CMH2
CMHCOR Cochran-Mantel-Haenszel correlation statisticALL or CMH or CMH1 or CMH2
CMHGA Cochran-Mantel-Haenszel general association statisticALL or CMH
CMHRMS Cochran-Mantel-Haenszel row mean scores (ANOVA) statisticALL or CMH or CMH2
COCHQ Cochran's QAGREE
CONTGY contingency coefficientALL or CHISQ
CRAMV Cramer's VALL or CHISQ
EQKAP test for equal simple kappasAGREE
EQWKP test for equal weighted kappasAGREE
FISHER | EXACT Fisher's exact testALL or CHISQ *
GAMMA gammaALL or MEASURES
JT Jonckheere-Terpstra testJT
KAPPA simple kappa coefficientAGREE
KENTB Kendall's tau-bALL or MEASURES
LAMCR lambda asymmetric (C|R)ALL or MEASURES
LAMDAS lambda symmetricALL or MEASURES
LAMRC lambda asymmetric (R|C)ALL or MEASURES
LGOR adjusted logit odds ratioALL or CMH or CMH1 or CMH2
LGRRC1 adjusted column 1 logit relative riskALL or CMH or CMH1 or CMH2
LGRRC2 adjusted column 2 logit relative riskALL or CMH or CMH1 or CMH2
LRCHI likelihood-ratio chi-squareALL or CHISQ
MCNEM McNemar's testAGREE
MEASURES gamma, Kendall's tau-b, Stuart's tau-c, Somers' D (C|R), Somers' D (R|C), Pearson correlation coefficient, Spearman correlation coefficient, lambda asymmetric (C|R), lambda asymmetric (R|C), lambda symmetric, uncertainty coefficient (C|R), uncertainty coefficient (R|C), and symmetric uncertainty coefficient; for 2 ×2 tables, odds ratio and relative risksALL or MEASURES
MHCHI Mantel-Haenszel chi-squareALL or CHISQ
MHOR adjusted Mantel-Haenszel odds ratioALL or CMH or CMH1 or CMH2
MHRRC1 adjusted column 1 Mantel-Haenszel relative riskALL or CMH or CMH1 or CMH2
MHRRC2 adjusted column 2 Mantel-Haenszel relative riskALL or CMH or CMH1 or CMH2
N number of nonmissing subjects for the stratum 
NMISS number of missing subjects for the stratum 
OR odds ratioALL or MEASURES or RELRISK
PCHI chi-square goodness-of-fit test for one-way tables; for two-way tables, Pearson chi-squareALL or CHISQ
PCORR Pearson correlation coefficientALL or MEASURES
PHI phi coefficientALL or CHISQ
PLCORR polychoric correlation coefficientPLCORR
RDIF1 column 1 risk difference (row 1 - row 2)RISKDIFF
RDIF2 column 2 risk difference (row 1 - row 2)RISKDIFF
RELRISK odds ratio and relative risks for 2 ×2 tablesALL or MEASURES or RELRISK
RISKDIFF risks and risk differencesRISKDIFF
RISKDIFF1 column 1 risks and risk differenceRISKDIFF
RISKDIFF2 column 2 risks and risk differenceRISKDIFF
RRC1 column 1 relative riskALL or MEASURES or RELRISK
RRC2 column 2 relative riskALL or MEASURES or RELRISK
RSK1 column 1 risk (overall)RISKDIFF
RSK11 column 1 risk, for row 1RISKDIFF
RSK12 column 2 risk, for row 1RISKDIFF
RSK2 column 2 risk (overall)RISKDIFF
RSK21 column 1 risk, for row 2RISKDIFF
RSK22 column 2 risk, for row 2RISKDIFF
SCORR Spearman correlation coefficientALL or MEASURES
SMDCR Somers' D (C|R)ALL or MEASURES
SMDRC Somers' D (R|C)ALL or MEASURES
STUTC Stuart's tau-cALL or MEASURES
TREND Cochran-Armitage test for trendTREND
TSYMM Bowker's test of symmetryAGREE
U symmetric uncertainty coefficientALL or MEASURES
UCR uncertainty coefficient (C|R)ALL or MEASURES
URC uncertainty coefficient (R|C)ALL or MEASURES
WTKAP weighted kappa coefficientAGREE

Using the TABLES Statement with the OUTPUT Statement

In order to specify that the OUTPUT data set contain a particular statistic, you must have PROC FREQ compute the statistic by using the corresponding option in the TABLES statement or the EXACT statement. For example, you cannot specify the option PCHI (Pearson chi-square) in the OUTPUT statement without also specifying a TABLES statement option or an EXACT statement option to compute the Pearson chi-square. The TABLES statement option ALL or CHISQ computes the Pearson chi-square.

Additionally, if you have only one TABLES statement, the EXACT statement option CHISQ or PCHI computes the Pearson chi-square.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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