Chapter Contents


The FREQ Procedure

PROC FREQ Statement

PROC FREQ <option(s)>;

To do this Use this option
Specify the input data set DATA=
Control printed output

Begin the next one-way table on the current page even if the entire table does not fit on that page COMPRESS

Specify the outline and cell divider characters for the cells of the crosstabulation tables FORMCHAR=

Suppress all displayed output NOPRINT

Specify the order to list the variable values ORDER=

Display one table per page PAGE


begins to display the next one-way frequency table on the same page as the preceding one-way table when 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.
Restriction: not valid with PAGE
Tip: COMPRESS saves paper and screen space.

specifies the input SAS data set.
Main discussion: Procedure Concepts

FORMCHAR <(position(s))>='formatting-character(s)'
defines the characters to use for constructing the outlines and dividers for the cells of crosstabulation tables.

identifies the position of one or more characters in the SAS formatting-character string. A space or a comma separates the positions.
Default: Omitting (position(s)), is the same as specifying all 20 possible SAS formatting characters, in order.
Range: PROC FREQ uses formatting characters 1, 2, and 7. Formatting Characters Used by PROC FREQ shows the formatting characters that PROC FREQ uses.

lists the characters to use for the specified positions. PROC FREQ assigns characters in formatting-character(s) to position(s), in the order that they are listed. For instance, the following option assigns the asterisk (*) to the second formatting character, the pound sign (#) to the seventh character, and does not alter the remaining characters:

Interaction: The SAS system option FORMCHAR= specifies the default formatting characters. The system option defines the entire string of formatting characters. Specifying the FORMCHAR= option in a procedure can redefine selected characters.
Tip: You can use any character in formatting-characters, including hexadecimal characters. If you use hexadecimal characters, you must put an x after the closing quote. For example the following option assigns the hexadecimal character 2D to the second formatting character, the hexadecimal character 7C to the seventh character, and does not alter the remaining characters:
Tip: Specifying all blanks for formatting-character(s) produces tables with no outlines or dividers:
formchar (1,2,7)=''

(3 blanks)

See also: For information on which hexadecimal codes to use for which characters, consult the documentation for your hardware.

Formatting Characters Used by PROC FREQ
Position Default Used to draw
1 | Vertical separators
2 - Horizontal separators
7 + Intersections of vertical and horizontal separators

suppresses all displayed output from PROC FREQ.
Interaction: NOPRINT in the PROC statement disables the Output Delivery System for the entire PROC step.
Tip: Use NOPRINT when you want to create only an output data set with the OUTPUT statement or with the OUT= option in the TABLES statement.

Note:   NOPRINT is also available in the TABLES statement where it suppresses the tables, but displays the requested statistics.  [cautionend]

orders the values of the frequency and crosstabulation table variables according to the specified order, where

orders values according to their order in the input data set.

orders values by their formatted values. This order is operating environment-dependent. By default, the order is ascending.

orders values by descending frequency count.

orders values by their unformatted values, which yields the same order as PROC SORT. This order is operating environment-dependent.

Restriction: ORDER= does not apply to missing values, which always appear first.
Featured in: Computing Chi-Square Tests for One-Way Frequency Tables and Computing Binomial Proportions for One-Way Frequency Tables

displays only one table per page.
Default: displays multiple tables per page as space permits
Restriction: not valid with COMPRESS

Chapter Contents



Top of Page

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