1
Paper 109 – 2010
Thirty Three Tricks with PROC REPORT:
A Quick Introduction to the Powerful REPORT Procedure
Ben Cochran, The Bedford Group, Raleigh, NC
Abstract
When the REPORT Procedure was first introduced by SAS with the advent of Version 6, most of the SAS world was
mainframe users. This new procedure brought with it a great deal of power and flexibility that added much strength
to SAS’ arsenal of report generating procedures. It had powerful formatting, summarizing, and analysis capabilities
that made it easier to create many different kinds of reports from a simple listing to a very complex report.
However, some critics have stated that, while it has awesome features, it looks like a mainframe report. That was
true until SAS released the Output Delivery System (ODS) experimentally in Version 7, and in production mode in
Version 8. If the REPORT procedure was a cake, then ODS delivers the icing to generate truly beautiful reports.
This paper offers a quick overview of the types of reports that can be generated with Proc REPORT, and how to
add some of the ODS features to deliver stunning reports.
Introduction
This paper is intended for users who have not worked with the REPORT procedure, or at least not lately. First, a
look is taken at the general syntax, and then a series of reports will be generated starting with a very simple report
and then working up to more complex reports.
Typical Syntax
The REPORT procedure is made up of a PROC statement, a COLUMN statement, several DEFINE statements,
and other optional statements that help with calculations and summarizations.
COLUMNS statement defines which columns appear in the report, and their order.
DEFINE statements declare how variables are to be used in the report.
COMPUTE blocks allow calculations to be performed in the report.
BREAK / RBREAK statements allow summarization and some kinds of formatting at certain places in the report.
The REPORT procedure also has many options that can be used. Some of the most often used options are:
• DATA= specifies the dataset to be processed,
• PROMPT invokes the prompting mode, sort of like a wizard
• NOWINDOWS suppresses the REPORT window and directs the report to the output window
• REPORT = specifies a stored report to be used in generating a new report
• OUTREPT= names a location to store the report
• OUT= creates a SAS data set
• HEADLINE creates a horizontal line between the column headers and the body of the report
• HEADSKIP creates a blank line between the column headers and the body of the report
PROC REPORT data= SAS-data-set options ;
COLUMNS variable_1 …. variable_n;
DEFINE variable_1;
DEFINE variable_2;
. . .
DEFINE variable_n;
COMPUTE blocks
BREAK … ;
RBREAK … ;
RUN;