Producing Frequency Tables Using PROC FREQ

The FREQ procedure is a descriptive procedure as well as a statistical procedure. It produces one-way and n-way frequency tables, and it concisely describes data by reporting the distribution of variable values. Use the FREQ procedure to create crosstabulation tables that summarize data for two or more categorical variables by showing the number of observations for each combination of variable values.

PROC FREQ Syntax

The FREQ procedure can include many statements and options for controlling frequency output.
Syntax, FREQ procedure:
PROC FREQ
<options>;
RUN;
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 PAGE=option.
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. 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.
NLEVELS
displays the "Number of Variable Levels" table, which provides the number of levels for each variable named in the TABLES statements.
NOPRINT
suppresses the display of all output. Use the NOPRINT option when all you want to create is an output data set.
ORDER=DATA | FORMATTED | FREQ | INTERNAL
specifies the order of the variable levels in the frequency and crosstabulation tables, which you request in the TABLES statement. By default, ORDER=INTERNAL. The FORMATTED and INTERNAL orders are machine-dependent. The ORDER= option does not apply to missing values, which are always ordered first. The ORDER= option can take the following values.
Table 9.4 ORDER=Option
Value of ORDER=
How Levels Are Ordered
DATA
Order of appearance in the input data set
FORMATTED
External formatted value, except for numeric variables with no explicit format, which are sorted by their unformatted (internal) value
FREQ
Descending frequency count; levels with the most observations come first in the order
INTERNAL
Unformatted value
By default, PROC FREQ creates a one-way table with the frequency, percent, cumulative frequency, and cumulative for of all variables in a data set. This can produce excessive or inappropriate output. It is recommended that you always use a TABLES statement with PROC FREQ.
Table 9.5 Default PROC FREQ Output
Variable
Frequency
Percent
Cumulative Frequency
Cumulative Percent
Value
Number of observations with the value
Frequency of the value divided by the total number of observations
Sum of the frequency counts of the value and all other values listed above it in the table
Cumulative frequency of the value divided by the total number of observations
For example, the following FREQ procedure creates a frequency table for each variable in the data set Finance.Loans. All the unique values are shown for the variables Department and Job Category.
proc freq data=finance.usa; 
run;
Figure 9.12 Frequency Table for Department and Job Category (partial HTML output)
Partial HTML Output: Frequency Table for Department and Job Category
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.126.199