How ODS Works with the DATA Step


Here are the basic steps for using ODS in conjunction with the DATA step to produce reports with enhanced formatting:

Table 3.1: Steps to Producing Enhanced ODS Output With the DATA Step

Steps

Tools

Comments

Specify formatting for your output.

ODS formatting statements can specify formats such as listing, HTML, RTF, PS, and PDF.

You can also produce output in multiple formats at the same time by specifying more than one format.

Note: If you want only the simple default listing output, then you don't need the ODS statement.

Specify structure.

The ODS option in the FILE statement lists the variables and their order in the output.

Additional suboptions give you even more control over the resulting structure.

Connect the data to the template.

The FILE PRINT ODS statement creates an output object by binding a data component to a table definition (template).

You can specify other details by using various ODS suboptions in the FILE PRINT ODS statement.

Output data.

The PUT statement writes variable values to the data component.

A simple way to output all variables is to use PUT _ODS_.

First, use ODS statements to specify how you want ODS to format your output, for example, as HTML, RTF or PDF. Then, in the DATA step, use the FILE PRINT ODS and PUT statements, with appropriate ODS-specific suboptions, to produce your report.

The PUT statement writes variable values, and the FILE PRINT ODS statement directs the output. [*] You can use ODS to produce the same output in multiple formats, and to produce output at a later time in a different format, without rerunning the DATA step.

You control the formatting that is applied to your reports by using the ODS formatting statements. They control the opening and closing of ODS destinations, which apply formatting to the output objects that you create with ODS and the DATA step.

Here is a list of topics, with sources for additional information.

Table 3.2: Where to Find More Information on How to Use ODS in the DATA Step

Topic

Where to learn more

ODS formatting statements

Chapter 5, 'Dictionary of ODS Language Statements,' on page 67

ODS destinations

'What Are the ODS Destinations?' on page 25

How ODS works

'How Does ODS Work?' on page 22

[*] If you do not specify a FILE statement, then the PUT statement writes tothe SAS log by default. If you use multiple PUT and FILE statements, then in addition to creating ODS-enhanced output, you can writeto the log, to the regular DATA step output buffer, or to another external file in the same DATA step.




SAS 9.1 Output Delivery System. Users Guide
SAS 9.1 Output Delivery System Users Guide
ISBN: 1590472187
EAN: 2147483647
Year: 2004
Pages: 99
Authors: SAS Institute

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net