Understanding ODS Destinations

Overview of ODS Destination Categories

ODS enables you to produce SAS procedure and DATA step output to many different destinations. ODS destinations are organized into two categories.
SAS Formatted destinations
produce output that is controlled and interpreted by SAS, such as a SAS data set, SAS output listing, or an ODS document.
Third-Party Formatted destinations
produce output that enables you to apply styles or markup languages, or enables you to print to physical printers using page description languages. For example, you can produce output in PostScript, HTML, XML, or a style or markup language that you created.
The following table lists the ODS destination categories, the destination that each category includes, and the formatted output that results from each destination.
Destination Category Table
SAS Formatted
ODS document
SAS output listing
SAS data set
Third-Party Formatted
HTML file for online viewing
Markup language tagsets
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 future destinations are added to ODS, they automatically will become available to the DATA step and to all procedures that support ODS.

Definition of Destination-Independent Input

Destination-independent input means that one destination can support a feature even though another destination does not support it. In this case, the request is ignored by the destination that does not support it. Otherwise, ODS would support a small subset of features that are common to all destinations. If this were true, then it would be difficult to move your reports from one output format to another output format. ODS provides many output formatting options, so that you can use the appropriate format for the output that you want. It is best to use the appropriate destination suited for your purpose.

The SAS Formatted Destinations

The SAS Formatted destinations create SAS entities such as a SAS data set, a SAS output listing, or an ODS document. The statements in the ODS SAS Formatted category create the SAS entities.
The three SAS Formatted destinations are as follows:
  • DOCUMENT Destination
    The DOCUMENT destination enables you to restructure, navigate, and replay your data in different ways and to different destinations as you like without needing to rerun your analysis or repeat your database query. The DOCUMENT destination makes your entire output stream available in "raw" form and accessible to you to customize. The output is kept in the original internal representation as a data component plus a table template. When the output is in a DOCUMENT form, it is possible to rearrange, restructure, and reformat without rerunning your analysis. Unlike other ODS destinations, the DOCUMENT destination has a GUI interface. However, everything that you can do through the GUI, you can also do with batch commands using the ODS DOCUMENT statement and the DOCUMENT procedure.
    Prior to SAS 9, each procedure or DATA step produced output that was sent to each destination that you specified. Although you could always send your output to as many destinations as you wanted, you needed to rerun your procedure or data query if you decided to use a destination that you had not originally designated. The DOCUMENT destination eliminates the need to rerun procedures or repeat data queries by enabling you to store your output objects and replay them to different destinations.
  • LISTING Destination
    The LISTING destination produces output that looks the same as the traditional SAS output.
    The LISTING destination enables you to produce traditional SAS output with the same look and presentation as it had in previous versions of SAS.
    Because most procedures share some of the same table templates, the output is more consistent. For example, if you have two different procedures producing an ANOVA table, they will both produce it in the same way because each procedure uses the same template to describe the table. However, there are three procedures that do not use a default table template to produce their output: the PRINT procedure, the REPORT procedure, and the TABULATE procedure's n-way tables. These procedures use the structure that you specify in your program code to define their tables.
  • OUTPUT Destination
    The OUTPUT destination produces SAS output data sets. Because ODS already knows the logical structure of the data and its native form, ODS can create a SAS data set that represents exactly the same resulting data set that the procedure worked with internally. The output data sets can be used for further analysis, or for sophisticated reports in which you want to combine similar statistics across different data sets into a single table. You can easily access and process your output data sets using all of the SAS data set features. For example, you can access your output data using variable names and perform WHERE-expression processing just as you would process data from any other SAS data set.

The Third-Party Formatted Destinations

The Third-Party Formatted destinations enable you to apply styles to the output objects that are used by applications other than SAS. For example, these destinations support attributes such as font and color.
Note: For a list of style attributes and valid values, see the style attributes table in Style Attributes Tables .
The four categories of Third-Party Formatted destinations are as follows:
  • HTML (Hypertext Markup Language )
    The HTML destination produces HTML 4.0 output that contains embedded style sheets. You can, however, produce HTML 3.2 output using the HTML3 statement. The HTML destination is the default destination that opens when you start your SAS session. Thus, ODS is always being used, even when you do not explicitly invoke ODS.
    The HTML destination can create some or all of the following:
    • an HTML file (called the body file) that contains the results from the procedure
    • a table of contents that links to the body file
    • a table of pages that links to the body file
    • a frame that displays the table of contents, the table of pages, and the body file
    If you do not want to link to your output, then you do not have to create a table of contents, a table of pages, or a frame file. However, if your output is very large, you might want to create a table of contents and a table of pages for easier reading and transversing through your file.
    The HTML destination is intended only for online use, not for printing. To print hard-copies of the output objects, use the PRINTER destination.
  • Markup Languages (markup) Family
    The same way as table templates describe table layout and style attributes describe the output style, tagsets describe how to produce markup language output. You can use a tagset that SAS supplies or you can create your own tagset using the TEMPLATE procedure. Similar to table templates and style attributes, tagsets enable you to modify your markup language output. For example, you can specify each variety of XML as a new tagset. SAS supplies you with a collection of XML tagsets and enables you to produce a customized variety of XML.
    The important point is that you can implement either a tagset that SAS supplies or a customized tagset that you created. You do not have to wait for the next release of SAS. The additional capability to modify and create your own tagsets by using PROC TEMPLATE gives you greater flexibility in customizing your output.
    Because the MARKUP destination is so flexible, you can use either the SAS tagsets or a tagset that you created. For a complete list of the markup language tagsets that SAS supplies, see the section on listing tagset names in ODS MARKUP Statement. To learn how to define your own tagsets, see the section on methods to create your own tagsets in TEMPLATE Procedure: Creating Markup Language Tagsets.
    The MARKUP destination cannot replace ODS PRINTER or ODS RTF destinations because it cannot do text measurement. Therefore, it cannot produce output for a page description language or a hybrid language like RTF, which requires all of the text to be measured and placed at a specific position on the page.
    However, SAS 9.2 introduces a measured markup destination that is based on the traditional markup and traditional page layout destinations. The first production tagset for this destination is for RTF. Others are planned. The primary distinction of this tagset is that SAS can determine where page breaks occur in a markup language implementation. See ODS TAGSETS.RTF Statement for specific information.
  • Printer Family
    The PRINTER destination produces output for the following:
    • printing to physical printers such as Windows printers under Windows, PCL, and PostScript printers on other operating systems
    • producing portable PostScript, PCL, and PDF files
    The PRINTER destinations produce ODS output that contains page description languages: they describe precise positions where each line of text, each rule, and each graphical element are to be placed on the page. In general, you cannot edit or alter these formats. Therefore, the output from ODS PRINTER is intended to be the final form of the report.
  • Rich Text Format (RTF)
    RTF produces output for Microsoft Word. Other applications can read RTF files, but the RTF output might not work successfully with them.
    The RTF destination enables you to view and edit the RTF output. ODS does not define the vertical measurement, which means that SAS does not determine the optimal place to position each item on the page. For example, page breaks are not always fixed, so you do not want your RTF output tables to split at inappropriate places when you edit your text. Your tables can remain whole and intact on one page or they can have logical breaks where you specify.
    Because Microsoft Word needs to know the widths of table columns and it cannot adjust tables if they are too wide for the page, ODS measures the width of the text and tables (horizontal measurement). Therefore, SAS can set all of the column widths properly and divide the table into panels if it is too wide to fit on a single page.
    In short, when SAS produces RTF output for input to Microsoft Word, it determines the horizontal measurement. Microsoft Word controls the vertical measurement. Because Microsoft Word can determine how much space is on the page, your tables display consistently even after you make changes to your RTF file.
    However, when you use measured RTF, which is implemented when you use the ODS TAGSETS.RTF statement, you can specify how and where page breaks occur. You can also specify when to place titles and footnotes into the body of a page. SAS becomes responsible for the implicit page breaks instead of Microsoft Word. See ODS TAGSETS.RTF Statement for specific information.

Controlling the Formatting Features of Third-Party Formats

All of the formatting features that control the appearance of the third-party formatted destinations beyond what the LISTING destination can do are controlled by two mechanisms:
  • ODS statement options
  • ODS style attributes
The ODS statement options control three features:
  1. features that are specific to a given destination, such as style sheets for HTML
  2. features that are global to the document, such as AUTHOR and table of contents generation
  3. features that we expect programmers to change on each document, such as the output filename
The ODS style attributes control the way that individual elements are created. Attributes are aspects of a given style, such as type face, weight, font size, and color. The values of the attributes collectively determine the appearance of each part of the document to which the style is applied. With style attributes, it is unnecessary to insert destination-specific code (such as raw HTML) into the document. Each output destination will interpret the attributes that are necessary to generate the presentation of the document. Because not all destinations are the same, not all attributes can be interpreted by all destinations. Style attributes that are incompatible with a selected destination are ignored. For example, PostScript does not support active links, so the URL= attribute is ignored when producing PostScript output.

ODS Destinations and System Resources

ODS destinations can be open or closed. You open and close a destination with the appropriate ODS statement. When a destination is open, ODS sends the output objects to it. An open destination uses system resources even if you use the selection and exclusion features of ODS to select or exclude all objects from the destination. Therefore, to conserve resources, close unnecessary destinations. See the documentation for individual ODS statements for detailed information.
By default, the HTML destination is open and all other destinations are closed. Consequently, if you do nothing, your SAS programs run and produce HTML output.