Previous Page | Next Page

Understanding and Customizing SAS Output: The Output Delivery System (ODS)

Selecting an Output Format

You select the format for your output by opening and closing ODS destinations in your program. When one or more destinations are open, ODS can send output objects to them and produce formatted output. When a destination is closed, ODS does not send an output object to it and no output is produced.

By default, all programs automatically produce Listing output along with output for other destinations that you specifically open. Therefore, by default, the Listing destination is open, and all other destinations are closed.

To create formatted output, open one or more destinations by using the following ODS statements:

ODS HTML file-specification(s);
ODS OUTPUT data-set-definition;
ODS PRINTER file-specification;
ODS RTF file-specification;

The argument file-specification opens the destination and specifies one or more files to write to. The argument data-set-definition opens the Output destination and enables SAS to create a data set from an output object.

To view or print the ODS output that you have selected, you need to close all the destinations that you opened, except for the Listing destination. You can use separate statements to close individual destinations, or use one statement to close all destinations (including the Listing destination). To close ODS destinations, use the following statements:

ODS HTML CLOSE;
ODS OUTPUT CLOSE;
ODS PRINTER CLOSE;
ODS RTF CLOSE;
ODS _ALL_ CLOSE;

Note:    The ODS _ALL_ CLOSE statement, which closes all open destinations, is available with SAS Release 8.2 and higher.  [cautionend]

In some cases you might not want to create Listing output. Use the ODS LISTING CLOSE; statement at the beginning of your program to close the Listing destination and prevent SAS from producing Listing output. Closing unnecessary destinations conserves system resources.

Note:   Because ODS statements are global statements, it is good practice to open the Listing destination at the end of your program. If you execute other programs in your current SAS session, Listing output is then available. To open the Listing destination, use the ODS LISTING; statement at the end of your program.   [cautionend]

Previous Page | Next Page | Top of Page