ODS global
statements provide greater flexibility to generate, customize, and
reproduce SAS procedure and DATA step output. You can use ODS global
statements to control different features of ODS. ODS statements can
be used anywhere in your SAS program. Some ODS statements remain in
effect until you explicitly change them. Other ODS statements are
automatically cleared. For complete documentation on ODS global statements,
see the chapter about ODS statements in the
SAS Output Delivery System: User's Guide.
ODS global statements
are organized into two types.
Output Control Statements
are statements that
provide descriptive information about the specified output objects,
and they indicate whether the style definition or table template is
provided by SAS. The ODS EXCLUDE, ODS SELECT, and ODS TRACE statements
are examples of output control statements.
Output control statements
can do the following:
-
select specific output objects
for specific destinations
-
exclude specific output objects
from specific destinations
-
specify the location where you
want to search for or store style definitions or table templates
-
verify whether you are using a
style definition or a table template that is provided by SAS
-
provide descriptive information
about each specified output object, such as its name, label, template,
path, and label path
ODS Destination (Report) Statements
are statements that
enable you to create output that is formatted for third-party software,
such as HTML, RTF, and PDF. Or, they enable you to create output that
is specific to SAS, such as an ODS document, LISTING output, or a
SAS data set.
You can use ODS destination
statements to generate and modify reports in formats such as HTML,
XML, PDF, PostScript, RTF, and Microsoft Excel. The form for an ODS
destination statement is the ODS statement block, which consists of
ODS statements that open and close one or more ODS destinations sandwiched
around your program. Your results are sent to one or more output destinations.
You can use one or more
ODS destination statements, one or more PROC or DATA steps, and an
ODS CLOSE statement to form an ODS statement block. An ODS block has
the following form:
ODS output-destination 1 <options(s)>;
...
ODS output-destination (n) <options(s)>
<your SAS program>
ODS destination close statement
1;
...
ODS destination close statement
(n)
In the ODS block,
output-destination is
the name of a valid ODS destination and
option(s) are
options that are valid for that destination. Your SAS program is inserted
between the beginning ODS destination statement and the ODS CLOSE
statement.
In the following example,
the output from PROC PRINT and PROC CONTENTS is sent to the PDF and
RTF destinations. The STYLE= option specifies what table template
to apply to the output. By default, the PDF opens in Adobe Acrobat
and the RTF opens in Microsoft Word.
options obs=10 nodate;
ods pdf file="myPdf.pdf" style=Banker;
ods rtf file="myRTF.rtf" style=BarrettsBlue text="RTF Output";
proc print data=sashelp.class;
run;
proc contents data=sashelp.class;
run;
ods pdf close;
ods rtf close;
PDF Output with Banker Style Applied
RTF Output with BarrettsBlue Style Applied
ODS destinations are organized into two
categories.
Destinations Formatted by SAS
These destinations
produce output that is controlled and interpreted by SAS, such as
a SAS data set, LISTING output, or an ODS document.
Destinations Formatted by a Third Party
These destinations
produce output that enables you to apply styles or markup languages.
You can print to physical printers using page description languages.
For example, you can produce output in PostScript, HTML, XML, or in
a markup language that you created.
The following table
lists the ODS destination categories, the destinations that each category
includes, and the formatted output that results from each destination.
Destination Category Table
|
|
|
|
|
|
|
|
|
|
|
|
Formatted by a Third
Party
|
|
HTML file for online
viewing
|
|
|
|
|
|
Printable output in
one of three different formats: PCL, PDF, or PS (PostScript)
|
|
|
Output written in Rich
Text Format for use with Microsoft Word 2000
|
As destinations are
added to ODS, they will automatically become available to the DATA
step and all procedures that support ODS.