Syntax, FREQ procedure:
PROC FREQ <options>;
RUN;
|
Option
|
Description
|
---|---|
COMPRESS
|
Begins the 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.
Note: 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 (position 1), the horizontal separators (position 2), and
the vertical-horizontal intersections (position 7). If you do not
specify the FORMCHAR= option, PROC FREQ uses FORMCHAR(1,2,7)='|-+'
by default.
Position 1
Default: |
The characters are
used to draw vertical separators.
Position 2
Default: —
The characters are
used to draw horizontal separators.
Position 7
Default: +
The characters are
used to draw intersections of vertical and horizontal separators.
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 quotation mark.
|
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. You can use the NOPRINT option when you want to create
only 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.
The ORDER= option can
take the following values:
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
Note: 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.
Note: The PAGE option is not valid
with the COMPRESS option.
|
proc freq data=cert.usa; run;
Syntax, TABLES statement:
TABLES variable(s);
|
proc freq data=cert.diabetes;
tables sex;
run;
proc freq data=cert.loans;
tables rate months;
run;
proc freq data=cert.survey;
tables item1-item3;
run;
Syntax, TABLES statement
for crosstabulation:
TABLES variable-1
*variable-2 <*
... variable-n>;
Tip:You can include up to 50 variables
in a single multi-way table request.
|
proc freq data=cert.diabetes;
tables sex*fastgluc;
run;
proc format;
value Survive 0='Dead'
1='Alive';
run;
proc freq data=cert.leukemia;
tables Survived*AG*WhiteCells;
format Survived survive.;
run;
Syntax, TABLES statement:
TABLES variable-1
*variable-2 <*
... variable-n> /
LIST;
Tip:You can include up to 50 variables
in a single multi-way table request.
|
proc format;
value survive 0='Dead'
1='Alive';
run;
proc freq data=cert.leukemia;
tables Survived*AG*WhiteCells / list;
format Survived survive.;
run;
proc format;
value survive 0='Dead'
1='Alive';
run;
proc freq data=cert.leukemia;
tables Survived*AG*whitecells / crosslist;
format Survived survive.;
run;
proc format;
value survive 0='Dead'
1='Alive';
run;
proc freq data=cert.leukemia;
tables Survived*AG*whitecells / nofreq norow nocol;
format Survived survive.;
run;