Output Delivery System and the DATA Step |
Here are the basic steps for using ODS in conjunction with the DATA step to produce reports with enhanced formatting:
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.(footnote 1) 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.
Topic | Where to learn more |
---|---|
ODS formatting statements |
Dictionary of ODS Language Statements |
ODS destinations |
Understanding ODS Destinations |
How ODS works |
Overview of How ODS Works |
FOOTNOTE 1: If you do not specify a FILE statement, then the PUT statement writes to the SAS log by default. If you use multiple PUT and FILE statements, then in addition to creating ODS-enhanced output, you can write to the log, to the regular DATA step output buffer, or to another external file in the same DATA step.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.