The Output Delivery System (ODS)

Overview of ODS

The SAS Output Delivery System (ODS) gives you flexibility in generating, storing, and reproducing SAS procedure and DATA step output along with a wide range of formatting options.
ODS enables you to create reports for popular software applications. For example, use the ODS PDF statement to create PDF files for viewing with Adobe Acrobat or for printing. With ODS, you easily create output in a variety of formats, including Microsoft Excel and Power Point, HTML, PDF, and RTF.

Opening and Closing ODS Destinations

You use ODS statements to specify destinations for your output. Each destination creates a specific type of formatted output. The following table lists some of the ODS destinations that are currently supported.
Destination
Result
Document
a hierarchy of output objects that enables you to render multiple ODS output without rerunning procedures.
EXCEL
writes Excel spreadsheet files that are compatible with Microsoft Office 2010 and later versions.
HTML
output that is formatted in Hypertext Markup Language (HTML). You do not have to specify the ODS HTML statement to produce basic HTML output.
Markup Languages Family
output that is formatted using markup languages such as Extensible Markup Language (XML).
Output
SAS data sets.
Printer Family (PDF, and so on)
output that is formatted for a high-resolution printer such as PostScript (PS), Portable Document Format (PDF), or Printer Control Language (PCL) files.
RTF
Rich Text Format output.
This book covers the EXCEL, HTML, PDF, and RTF destinations.
Note: SAS Studio has user interface controls to create and save HTML, PDF, and RTF ODS output.

Using Statements to Open and Close ODS Destinations

Syntax

For each type of formatted output that you want to create, you use an ODS statement to open the destination. At the end of your program, you use another ODS statement to close the destination so that you can access your output.
Syntax, ODS statement to open and close destinations:
ODS open-destination;
ODS close-destination CLOSE;
  • open-destination is a keyword, and any required options for the type of output that you want to create. Here are examples:
    • HTML FILE='html-file-pathname'
    • LISTING
  • close-destination is a keyword for the type of output.
You can issue ODS statements in any order, depending on whether you need to open or close the destination. Most ODS destinations are closed by default. You open them at the beginning of your program and close them at the end. The exception is the HTML destination, which is open by default.
Figure 16.1 Default ODS Destination
Default ODS Destination

Closing Multiple ODS Destinations at Once

You can produce output in multiple formats at once by opening each ODS destination at the beginning of the program.
When you have more than one open ODS destination, you can use the keyword _ALL_ in the ODS CLOSE statement to close all open destinations at once.

Closing the HTML Destination

Because open destinations use system resources, it is a good idea to close the HTML destination at the beginning of your program if you do not want to produce HTML output. Here is an example:
ods html close;
The HTML destination remains closed until you end your current SAS session or until you re-open the destination. It is good programming practice to reset the ODS destination to HTML output (the default setting) at the end of your programs.
ods html path="%qsysfunc(pathname(work))";
Last updated: August 23, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.133.180