PROC FREQ produces two types of output data sets that you can use with other statistical and reporting procedures. You can request these data sets as follows:
Specify the OUT= option in a TABLES statement. This creates an output data set that contains frequency or crosstabulation table counts and percentages
Specify an OUTPUT statement. This creates an output data set that contains statistics.
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.
In addition to these two output data sets, you can create a SAS data set from any piece of PROC FREQ output by using the Output Delivery System. See the section ODS Table Names for more information.
The OUT= option in the TABLES statement creates an output data set that contains one observation for each combination of variable values (or table cell) in the last table request. By default, each observation contains the frequency and percentage for the table cell. When the input data set contains missing values, the output data set also contains an observation with the frequency of missing values. The output data set includes the following variables:
BY variables
table request variables, such as A
, B
, C
, and D
in the table request A
*B
*C
*D
COUNT
, which contains the table cell frequency
PERCENT
, which contains the table cell percentage
If you specify the OUTEXPECT option in the TABLES statement for a twoway or multiway table, the output data set also includes expected frequencies. If you specify the OUTPCT option for a twoway or multiway table, the output data set also includes row, column, and table percentages. The additional variables are as follows:
EXPECTED
, which contains the expected frequency
PCT_TABL
, which contains the percentage of twoway table frequency, for nway tables where n > 2
PCT_ROW
, which contains the percentage of row frequency
PCT_COL
, which contains the percentage of column frequency
If you specify the OUTCUM option in the TABLES statement for a oneway table, the output data set also includes cumulative frequencies and cumulative percentages. The additional variables are as follows:
CUM_FREQ
, which contains the cumulative frequency
CUM_PCT
, which contains the cumulative percentage
The OUTCUM option has no effect for twoway or multiway tables.
The following PROC FREQ statements create an output data set of frequencies and percentages:
proc freq; tables A A*B / out=D; run;
The output data set D
contains frequencies and percentages for the table of A
by B
, which is the last table request listed in the TABLES statement. If A
has two levels (1 and 2), B
has three levels (1,2, and 3), and no table cell count is 0 or missing, the output data set D
includes six observations, one for each combination of A
and B
levels. 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
levels. The value of PERCENT
is the percentage of the total number of observations with 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 the levels 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 for X
.
The OUTPUT statement creates a SAS data set that contains statistics computed by PROC FREQ. Table 3.7 lists the statistics that can be stored in the output data set. You identify which statistics to include by specifying outputoptions. For more information, see the description of the OUTPUT statement.
If you specify multiple TABLES statements or multiple table requests in a single TABLES statement, the contents of the output data set correspond to the last table request.
For a oneway table or a twoway table, the output data set contains one observation that stores the requested statistics for the table. For a multiway table, the output data set contains an observation for each twoway table (stratum) of the multiway crosstabulation. If you request summary statistics for the multiway table, the output data set also contains an observation that stores the acrossstrata summary statistics. If you use a BY statement, the output data set contains an observation (for oneway or twoway tables) or set of observations (for multiway tables) for each BY group.
The OUTPUT data set can include the following variables:
BY variables
Variables that identify the stratum for multiway tables, such as A
and B
in the table request A
*B
*C
*D
Variables that contain the specified statistics
In addition to the specified estimate or test statistic, the output data set includes associated values such as standard errors, confidence limits, pvalues, and degrees of freedom.
PROC FREQ constructs variable names for the statistics in the output data set by enclosing the outputoption names in underscores. Variable names for the corresponding standard errors, confidence limits, pvalues, and degrees of freedom are formed by combining the outputoption names with prefixes that identify the associated values. Table 3.21 lists the prefixes and their descriptions.
Table 3.21: Output Data Set Variable Name Prefixes
Prefix 
Description 


Asymptotic standard error (ASE) 

Lower confidence limit 

Upper confidence limit 

Null hypothesis ASE 

Standardized value 

Degrees of freedom 

pvalue 

Twosided pvalue 

Leftsided pvalue 

Rightsided pvalue 

Exact pvalue 

Exact twosided pvalue 

Exact leftsided pvalue 

Exact rightsided pvalue 

Exact point probability 

Exact mid pvalue 

Exact lower confidence limit 

Exact upper confidence limit 
For example, the PCHI outputoption in the OUTPUT statement includes the Pearson chisquare test in the output data set. The variable names for the Pearson chisquare statistic,
its degrees of freedom, and the corresponding pvalue are _PCHI_
, DF_PCHI
, and P_PCHI
, respectively. For variables that were added to the output data set before SAS/STAT 8.2, PROC FREQ truncates the variable
name to eight characters when the length of the prefix plus the outputoption name exceeds eight characters.