Previous Page | Next Page

The FREQ Procedure

OUTPUT Statement

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

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:

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

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.

Table 3.7 OUTPUT Statement Options

Option

Output Data Set Statistics

Required TABLES Statement Option

AGREE

McNemar’s test, Bowker’s test, simple and

AGREE

 

weighted kappas; for multiple strata, overall

 
 

simple and weighted kappas, tests for equal

 
 

kappas, and Cochran’s

 

AJCHI

Continuity-adjusted chi-square ( tables)

CHISQ

ALL

CHISQ, MEASURES, and CMH statistics; N

ALL

BDCHI

Breslow-Day test ( tables)

CMH, CMH1, or CMH2

BINOMIAL

Binomial statistics for one-way tables

BINOMIAL

CHISQ

For one-way tables, goodness-of-fit test;

CHISQ

 

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

 

CMH

Cochran-Mantel-Haenszel (CMH) correlation,

CMH

 

row mean scores (ANOVA), and general

 
 

association statistics; for tables, logit and

 
 

Mantel-Haenszel adjusted odds ratios and

 
 

relative risks, Breslow-Day test

 

CMH1

CMH output, except row mean scores (ANOVA)

CMH or CMH1

 

and general association statistics

 

CMH2

CMH output, except general association statistic

CMH or CMH2

CMHCOR

CMH correlation statistic

CMH, CMH1, or CMH2

CMHGA

CMH general association statistic

CMH

CMHRMS

CMH row mean scores (ANOVA) statistic

CMH or CMH2

COCHQ

Cochran’s ( tables)

AGREE

CONTGY

Contingency coefficient

CHISQ

CRAMV

Cramer’s

CHISQ

EQKAP

Test for equal simple kappas

AGREE

EQOR | ZELEN

Zelen’s test for equal odds ratios ( tables)

CMH and EXACT EQOR

EQWKP

Test for equal weighted kappas

AGREE

FISHER

Fisher’s exact test

CHISQ or FISHER 1

GAILSIMON

Gail-Simon test

GAILSIMON

GAMMA

Gamma

MEASURES

JT

Jonckheere-Terpstra test

JT

KAPPA

Simple kappa coefficient

AGREE

KENTB

Kendall’s tau-

MEASURES

LAMCR

Lambda asymmetric

MEASURES

LAMDAS

Lambda symmetric

MEASURES

LAMRC

Lambda asymmetric

MEASURES

LGOR

Adjusted logit odds ratio ( tables)

CMH, CMH1, or CMH2

LGRRC1

Adjusted column 1 logit relative risk

CMH, CMH1, or CMH2

LGRRC2

Adjusted column 2 logit relative risk

CMH, CMH1, or CMH2

LRCHI

Likelihood-ratio chi-square

CHISQ

MCNEM

McNemar’s test ( tables)

AGREE

MEASURES

Gamma, Kendall’s tau-, Stuart’s tau-,

MEASURES

 

Somers’ and , Pearson and

 
 

Spearman correlations, lambda asymmetric

 
 

and , lambda symmetric,

 
 

uncertainty coefficients and ,

 
 

symmetric uncertainty coefficient;

 
 

odds ratio and relative risks ( tables)

 

MHCHI

Mantel-Haenszel chi-square

CHISQ

MHOR | COMOR

Adjusted Mantel-Haenszel odds ratio

CMH, CMH1, or CMH2

 

( tables)

 

MHRRC1

Adjusted column 1 Mantel-Haenszel relative risk

CMH, CMH1, or CMH2

MHRRC2

Adjusted column 2 Mantel-Haenszel relative risk

CMH, CMH1, or CMH2

N

Number of nonmissing observations

 

NMISS

Number of missing observations

 

OR

Odds ratio ( tables)

MEASURES or RELRISK

PCHI

Chi-square goodness-of-fit test for one-way tables,

CHISQ

 

Pearson chi-square for two-way tables

 

PCORR

Pearson correlation coefficient

MEASURES

PHI

Phi coefficient

CHISQ

PLCORR

Polychoric correlation coefficient

PLCORR

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 ( tables)

MEASURES or RELRISK

RISKDIFF

Risks and risk differences ( tables)

RISKDIFF

RISKDIFF1

Column 1 risks and risk difference

RISKDIFF

RISKDIFF2

Column 2 risks and risk difference

RISKDIFF

RRC1

Column 1 relative risk

MEASURES or RELRISK

RRC2

Column 2 relative risk

MEASURES or RELRISK

RSK1

Column 1 risk, overall

RISKDIFF

RSK11

Column 1 risk, for row 1

RISKDIFF

RSK12

Column 2 risk, for row 1

RISKDIFF

RSK2

Column 2 risk, overall

RISKDIFF

RSK21

Column 1 risk, for row 2

RISKDIFF

RSK22

Column 2 risk, for row 2

RISKDIFF

SCORR

Spearman correlation coefficient

MEASURES

SMDCR

Somers’

MEASURES

SMDRC

Somers’

MEASURES

STUTC

Stuart’s tau-

MEASURES

TREND

Cochran-Armitage test for trend

TREND

TSYMM

Bowker’s test of symmetry

AGREE

U

Symmetric uncertainty coefficient

MEASURES

UCR

Uncertainty coefficient

MEASURES

URC

Uncertainty coefficient

MEASURES

WTKAP

Weighted kappa coefficient

AGREE

Previous Page | Next Page | Top of Page