You are on page 1of 4

PROC PRINT :

PROC PRINT DATA = data-set NOOBS LABEL;


BY variable-list;
ID variable-list;
SUM variable-list;
VAR variable-list;
FORMAT DateReturned DATE9. Profit DOLLAR6.2 ;
If you dont want observation numbers, use the NOOBS option in the PROC PRINT statement. If you
define variable labels with a LABEL statement, and you want to print the labels instead of the variable
names, then add the LABEL option as well.

BY variable-list; The BY statement starts a new section in the output for each new value of the
BY variables and prints the values of the BY variables at the top of each section. The data must
be presorted by the BY variables.
ID variable-list; When you use the ID statement, the observation numbers are not printed.
Instead, the variables in the ID variable list appear on the left-hand side of the page.
SUM variable-list; The SUM statement prints sums for the variables in the list.
VAR variable-list; The VAR statement specifies which variables to print and the order. Without a
VAR statement, all variables in the SAS data set are printed in the order that they occur in the
data set.
FORMAT statement : The FORMAT statement starts with the keyword FORMAT, followed by the
variable name (or names if more than one variable is to be associated with the same format), followed by
the format.
format with the variable SaleDate:

FORMAT Profit Loss DOLLAR8.2 SaleDate MMDDYY8.;

FORMAT statements can go in either DATA steps or PROC steps. If the FORMAT statement is in a DATA
step, then the format association is permanent and is stored with the SAS data set. If the FORMAT
statement is in a PROC step, then it is temporaryaffecting only the results from that procedure.
The general forms of a SAS format are

Character Numeric Date
$formatw. formatw.d formatw.

PUT statement :You can also use formats in PUT statements when writing raw data files or reports.
Place a format after each variable name, as in the following example:

PUT Profit DOLLAR8.2 Loss DOLLAR8.2 SaleDate MMDDYY8.;





PROC FORMAT:

The FORMAT procedure creates formats that will later be associated with variables in a FORMAT
statement. The procedure starts with the statement PROC FORMAT and continues with one or more
VALUE statements (other optional statements are available):

PROC FORMAT;
VALUE name range-1 = 'formatted-text-1'
range-2 = 'formatted-text-2'
.
.
.
range-n = 'formatted-text-n';

ex:

PROC FORMAT;
VALUE gender 1 = 'Male'
2 = 'Female';
VALUE agegroup 13 -< 20 = 'Teen'
20 -< 65 = 'Adult'
65 - HIGH = 'Senior';
VALUE $col 'W' = 'Moon White'
'B' = 'Sky Blue'
'Y' = 'Sunburst Yellow'
'G' = 'Rain Cloud Gray';

PROC MEANS :

The MEANS procedure provides simple statistics on numeric variables.The MEANS
procedure starts with the keywords PROC MEANS, followed by options listing the statistics you want
printed:

PROC MEANS options( MAX MIN MEAN MEDIAN MODE N NMISS RANGE STDDEV SUM);
BY variable-list;
CLASS variable-list;
VAR variable-list;

MAX the maximum value
MIN the minimum value
MEAN the mean
MEDIAN the median
MODE the mode (new in SAS 9.2)
N number of non-missing values
NMISS number of missing values
RANGE the range
STDDEV the standard deviation
SUM the sum;

BY variable-list; The BY statement performs separate analyses for each level of the variables in the list.1
The data must first be sorted in the same order as the variable-list. (You can use PROC SORT to do this.)
CLASS variable-list; The CLASS statement also performs separate analyses for each level of the
variables in the list, 1 but its output is more compact than with the BY statement, and the data do not have
to be sorted first.
VAR variable-list; The VAR statement specifies which numeric variables to use in the analysis. If it is
absent then SAS uses all numeric variables.















Tracing and Selecting Procedure Output :

The ODS TRACE statement The ODS TRACE statement tells SAS to print information
about output objects in your SAS log. There are two ODS TRACE statements: one to turn on the trace,
and one to turn it off. Here is how to use these statements in a program:

ODS TRACE ON;
the PROC steps you want to trace go here
RUN;
ODS TRACE OFF;

Notice that the RUN statement comes before the ODS TRACE OFF statement. Unlike most other
SAS statements, the ODS statement executes immediatelywithout waiting for a RUN, PROC,
or DATA statement. If you put the ODS TRACE OFF statement before the RUN statement, then
the trace would turn off before the procedure completes.

You might also like