Previous Page | Next Page

The FREQ Procedure

PROC FREQ Statement
PROC FREQ <options> ;

The PROC FREQ statement invokes the procedure and optionally identifies the input data set. By default, the procedure uses the most recently created SAS data set.

Table 35.4 lists the options available in the PROC FREQ statement. Descriptions follow in alphabetical order.

Table 35.4 PROC FREQ Statement Options

Option

Description

COMPRESS

begins the next one-way table on the current page

DATA=

names the input data set

FORMCHAR=

specifies the outline and cell divider characters for crosstabulation tables

NLEVELS

displays the number of levels for all TABLES variables

NOPRINT

suppresses all displayed output

ORDER=

specifies the order for reporting variable values

PAGE

displays one table per page

You can specify the following options in the PROC FREQ statement.

COMPRESS

begins display of the next one-way frequency table on the same page as the preceding one-way table if there is enough space to begin the table. By default, the next one-way table begins on the current page only if the entire table fits on that page. The COMPRESS option is not valid with the PAGE option.

DATA=SAS-data-set

names the SAS data set to be analyzed by PROC FREQ. If you omit the DATA= option, the procedure uses the most recently created SAS data set.


FORMCHAR(1,2,7)='formchar-string'

defines the characters to be used for constructing the outlines and dividers for the cells of crosstabulation table displays. The formchar-string should be three characters long. The characters are used to draw the vertical separators (1), the horizontal separators (2), and the vertical-horizontal intersections (7). If you do not specify the FORMCHAR= option, PROC FREQ uses FORMCHAR(1,2,7)='|-+' by default. Table 35.5 summarizes the formatting characters used by PROC FREQ.

Table 35.5 Formatting Characters Used by PROC FREQ

Position

Default

Used to Draw

1

|

vertical separators

2

-

horizontal separators

7

+

intersections of vertical and horizontal separators

The FORMCHAR= option can specify 20 different SAS formatting characters used to display output; however, PROC FREQ uses only the first, second, and seventh formatting characters. Therefore, the proper specification for PROC FREQ is FORMCHAR(1,2,7)= 'formchar-string'.

Specifying all blanks for formchar-string produces crosstabulation tables with no outlines or dividers—for example, FORMCHAR(1,2,7)=' '. You can use any character in formchar-string, including hexadecimal characters. If you use hexadecimal characters, you must put an x after the closing quote. For information about which hexadecimal codes to use for which characters, see the documentation for your hardware.

See the CALENDAR, PLOT, and TABULATE procedures in the Base SAS Procedures Guide for more information about form characters.

NLEVELS

displays the "Number of Variable Levels" table, which provides the number of levels for each variable named in the TABLES statements. See the section Number of Variable Levels Table for details. PROC FREQ determines the variable levels from the formatted variable values, as described in the section Grouping with Formats.

NOPRINT

suppresses the display of all output. You can use the NOPRINT option when you only want to create an output data set. See the section Output Data Sets for information about the output data sets produced by PROC FREQ. Note that the NOPRINT option temporarily disables the Output Delivery System (ODS). For more information, see Chapter 20, Using the Output Delivery System.

Note: A NOPRINT option is also available in the TABLES statement. It suppresses display of the crosstabulation tables but allows display of the requested statistics.


ORDER=DATA | FORMATTED | FREQ | INTERNAL

specifies the order in which the values of the frequency and crosstabulation table variables are reported. PROC FREQ interprets the values of the ORDER= option as follows:

DATA

orders values according to their order in the input data set

FORMATTED

orders values by their formatted values (in ascending order). This order is dependent on the operating environment.

FREQ

orders values by their descending frequency counts

INTERNAL

orders values by their unformatted values, which yields the same order that the SORT procedure does. This order is dependent on the operating environment.

By default, ORDER=INTERNAL. The ORDER= option does not apply to missing values, which are always ordered first.

PAGE

displays only one table per page. Otherwise, PROC FREQ displays multiple tables per page as space permits. The PAGE option is not valid with the COMPRESS option.

Previous Page | Next Page | Top of Page