Output Delivery System


What Is the Output Delivery System?

The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure and DATA step output, with a wide range of formatting options. ODS provides formatting functionality that is not available from individual procedures or from the DATA step alone. ODS overcomes these limitations and enables you to format your output more easily.

Prior to Version 7, most SAS procedures generated output that was designed for a traditional line-printer. This type of output has limitations that prevents you from getting the most value from your results:

  • Traditional SAS output is limited to monospace fonts. With today s desktop document editors and publishing systems, you need more versatility in printed output.

  • Some commonly used procedures do not produce output data sets. Prior to ODS, if you wanted to use output from one of these procedures as input to another procedure, then you relied on PROC PRINTTO and the DATA step to retrieve results.

Gallery of ODS Samples

Introduction to the ODS Samples

This section shows you samples of the different kinds of formatted output that you can produce with ODS. The input file contains sales records for TruBlend Coffee Makers, a company that distributes coffee machines.

Listing Output

Traditional SAS output is Listing output. You do not need to change your SAS programs to create listing output. By default, you continue to create this kind of output even if you also create a type of output that contains more formatting.

Output 2.1: Listing Output
start example
 Average Quarterly Sales Amount by Each Sales Representative         1  --------------------------------- Quarter=1 ----------------------------------                              The MEANS Procedure                         Analysis Variable : AmountSold                       N  SalesRep           Obs      N        Mean     Std Dev    Minimum     Maximum  ____________________________________________________________________________  Garcia               8      8     14752.5     22806.1      495.0     63333.7  Hollingsworth        5      5     11926.9     12165.2      774.3     31899.1  Jensen               5      5     10015.7      8009.5     3406.7    20904.8  ____________________________________________________________________________           Average Quarterly Sales Amount by Each Sales Representative   2            --------------------------------- Quarter=2 ----------------------------------                              The MEANS Procedure                         Analysis Variable : AmountSold                       N  SalesRep           Obs      N        Mean     Std Dev     Minimum    Maximum  ____________________________________________________________________________  Garcia               6      6     18143.3     20439.6      1238.8    53113.6  Hollingsworth        6      6     16026.8     14355.0      1237.5    34686.4  Jensen               6      6     12455.1     12713.7      1393.7    34376.7  ____________________________________________________________________________           Average Quarterly Sales Amount by Each Sales Representative   3  --------------------------------- Quarter=3 ----------------------------------                              The MEANS Procedure                         Analysis Variable : AmountSold                       N  SalesRep           Obs      N        Mean     Std Dev     Minimum    Maximum  ____________________________________________________________________________  Garcia              21     21     10729.8     11457.0      2787.3    38712.5  Hollingsworth       15     15      7313.6      7280.4      1485.0    30970.0  Jensen              21     21     10585.3      7361.7      2227.5    27129.7  ____________________________________________________________________________           Average Quarterly Sales Amount by Each Sales Representative   4  --------------------------------- Quarter=4 ----------------------------------                              The MEANS Procedure                         Analysis Variable : AmountSold                       N  SalesRep           Obs      N        Mean     Std Dev     Minimum    Maximum  ____________________________________________________________________________  Garcia               5      5     11973.0     10971.8      3716.4    30970.0  Hollingsworth        6      6     13624.4     12624.6      5419.8    38093.1  Jensen               6      6     19010.4     15441.0      1703.4    38836.4  ____________________________________________________________________________ 
end example
 

PostScript Output

With ODS, you can produce output in PostScript format.

click to expand
Display 2.1: PostScript Output Viewed with Ghostview

HTML Output

With ODS, you can produce output in HTML (Hypertext Markup Language.) You can browse these files with Internet Explorer, Netscape, or any other browser that fully supports the HTML 3.2 tagset.

Note: To create HTML 4.0 tagsets, use the ODS HTML4 statement. In SAS 9, the ODS HTML statement generates HTML 3.2 tagsets. In future releases of SAS, the ODS HTML statement will support the most current HTML tagsets available.

click to expand
Display 2.2: HTML Output Viewed with Microsoft Internet Explorer

RTF Output

With ODS, you can produce RTF (Rich Text Format) output which is used with Microsoft Word.

click to expand
Display 2.3: RTF Output Viewed with Microsoft Word

PDF Output

With ODS, you can produce output in PDF (Portable Document Format), which can be viewed with the Adobe Acrobat Reader.

click to expand
Display 2.4: PDF Output Viewed with Adobe Acrobat Reader

XML Output

With ODS, you can produce output that is tagged with XML (Extensible Markup Language) tags.

Output 2.2: XML Output file
start example
 <?xml version="1.0" encoding="windows-1252"?>  <odsxml>  <head>  <meta operator="user"/>  </head>  <body>  <proc name="Print">  <label name="IDX"/>  <title class="SystemTitle" toc-level="1">US Census of Population and Housing</title>  <branch name="Print" label="The Print Procedure" class="ContentProcName" toc-level="1">  <leaf name="Print" label="Data Set SASHELP.CLASS" class="ContentItem" toc-level="2">  <output name="Print" label="Data Set SASHELP.CLASS" clabel="Data Set SASHELP.CLASS">  <output-object type="table" class="Table">    <style>      <border spacing="1" padding="7" rules="groups" frame="box"/>    </style>  <colspecs columns="6">  <colgroup>  <colspec name="1" width="2" align="right" type="int"/>  </colgroup>  <colgroup>  <colspec name="2" width="7" type="string"/>  <colspec name="3" width="1" type="string"/>  <colspec name="4" width="2" align="decimal" type="double"/>  <colspec name="5" width="4" align="decimal" type="double"/>  <colspec name="6" width="5" align="decimal" type="double"/>  </colgroup>  </colspecs>  <output-head>  <row>  <header type="string" class="Header" row="1" column="1">  <value>Obs</value>  </header>  <header type="string" class="Header" row="1" column="2">  <value>Name</value>  </header>  <header type="string" class="Header" row="1" column="3">  <value>Sex</value>  </header>  <header type="string" class="Header" row="1" column="4">  <value>Age</value>  </header>  <header type="string" class="Header" row="1" column="5">  <value>Height</value>  </header>  <header type="string" class="Header" row="1" column="6">  <value>Weight</value>  </header>  </row>  </output-head>  <output-body>  <row>  <header type="double" class="RowHeader" row="2" column="1">  <value> 1</value>  </header>  <data type="string" class="Data" row="2" column="2">  <value>Alfred</value>  </data>  ... more xml tagged output...  <  /odsxml> 
end example
 

Commonly Used ODS Terminology

data component

  • is a form, similar to a SAS data set, that contains the results ( numbers and characters ) of a DATA step or PROC step that supports ODS.

table definition

  • is a set of instructions that describes how to format the data. This description includes but is not limited to

    • the order of the columns

    • text and order of column headings

    • formats for data

    • font sizes and font faces.

output object

  • is an object that contains both the results of a DATA step or PROC step and information about how to format the results. An output object has a name, label, and path . For example, the Basic Statistical Measurement table generated from the UNIVARIATE procedure is an output object. It contains the data component and formatted presentation of the mean, median, mode, standard deviation, variance, range, and interquartile range.

    Note: Although many output objects include formatting instructions, not all of them do. In some cases the output object consists of only the data component.

ODS destinations

  • are designations that produce specific types of output. ODS supports a number of destinations, including the following:

    • LISTING

      • produces traditional SAS output (monospace format).

    • Markup Languages

      • produce SAS output that is formatted using one of many different markup languages such as HTML (Hypertext Markup Language), XML (Extensible Markup Language), and LaTeX that you can access with a web browser. SAS supplies many markup languages for you to use ranging from DOCBOOK to TROFF. You can specify a markup language that SAS supplies or create one of your own and store it as a user-defined markup language.

    • DOCUMENT

      • produces a hierarchy of output objects that enables you to produce multiple ODS output formats without rerunning a PROC or DATA step and gives you more control over the structure of the output.

    • OUTPUT

      • produces a SAS data set.

    • Printer Family

      • produces output that is formatted for a high-resolution printer such as a PostScript (PS), PDF, or PCL file.

    • RTF

      • produces output that is formatted for use with Microsoft Word.

ODS output

  • ODS output consists of formatted output from any of the ODS destinations. For example, the OUTPUT destination produces SAS data sets; the LISTING destination produces listing output; the HTML destination produces output that is formatted in Hypertext Markup Language.

How Does ODS Work?

Components of SAS Output

The PROC or DATA step supplies raw data and the name of the table definition that contains the formatting instructions, and ODS formats the output. You can use the Output Delivery System to format output from individual procedures and from the DATA step in many different forms other than the default SAS listing output. The following figure shows how SAS produces ODS output.

click to expand
Figure 2.1: ODS Processing: What Goes in and What Comes Out

* List of Tagsets that SAS Supplies and Supports

 
Table 2.2: * List of Tagsets that SAS Supplies and Supports

CHTML

HTML4

SASIOXML

SASXMOH

CSVALL

HTMLCSS

SASREPORT

SASXMOIM

DEFAULT

IMODE

SASXML

SASXMOR

DOCBOOK

PHTML

SASXMOG

WML

EVENT_MAP

* List of Tagsets that SAS Supplies but Does Not Support

 
Table 2.3: Additional Tagsets that SAS Supplies but Does Not Support

COLORLATEX

LATEX

SHORT_MAP

TPL_STYLE_MAP

CSV

LATEX2

STYLE_DISPLAY

TROFF

CSVBYLINE

NAMEDHTML

STYLE_POPUP

WMLOLIST

GRAPH

ODSSTYLE

TEXT_MAP

GTABLEAPPLET

PYX

TPL_STYLE_LIST

CAUTION:

These tagsets are experimental tagsets. Do not use these tagsets in production jobs.

Features of ODS

ODS is designed to overcome the limitations of traditional SAS output and to make it easy to access and create the new formatting options. ODS provides a method of delivering output in a variety of formats, and makes the formatted output easy to access.

Important features of ODS include the following:

  • ODS combines raw data with one or more table definitions to produce one or more output objects. These objects can be sent to any or all ODS destinations. You control the specific type of output from ODS by selecting an ODS destination. The currently available ODS destinations can produce

    • traditional monospace output

    • an output data set

    • an ODS document that contains a hierarchy file of the output objects

    • output that is formatted for a high-resolution printer such as PostScript and PDF

    • output that is formatted in various markup languages such as HTML

    • RTF output that is formatted for use with Microsoft Word.

  • ODS provides table definitions that define the structure of the output from SAS procedures and from the DATA step. You can customize the output by modifying these definitions, or by creating your own.

  • ODS provides a way for you to choose individual output objects to send to ODS destinations. For example, PROC UNIVARIATE produces five output objects. You can easily create HTML output, an output data set, traditional listing output, or printer output from any or all of these output objects. You can send different output objects to different destinations.

  • In the SAS windowing environment, ODS stores a link to each output object in the Results folder in the Results window.

  • Because formatting is now centralized in ODS, the addition of a new ODS destination does not affect any procedures or the DATA step. As future destinations are added to ODS, they will automatically become available to the DATA step and all procedures that support ODS.

  • With ODS, you can produce output for numerous destinations from a single source, but you do not need to maintain separate sources for each destination. This feature saves you time and system resources by enabling you to produce multiple kinds of output with a single run of your procedure or data query.

What Are the 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 which enables you to apply styles, 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.

Table 2.4: Destination Category Table

Category

Destinations

Results

SAS Formatted

DOCUMENT

ODS document

 

LISTING

SAS output listing

 

OUTPUT

SAS data set

Third-Party Formatted

HTML

HTML file for online viewing

 

MARKUP

markup language tagsets

 

PRINTER

printable output in one of three different formats: PCL, PDF, or PS (PostScript)

 

RTF

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 only common to all destinations. If this was 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:

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 definition. 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. While 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 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 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 definitions, 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 four procedures that do not use a default table definition to produce their output: PRINT procedure, REPORT procedure, TABULATE procedure, and FREQ procedure s n-way tables. These procedures use the structure that you specified 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 output 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 elements and valid values, see the style elements table in the The Complete Guide to the SAS Output Delivery System .

The four categories of third-party formatted destinations are:

  • HTML (Hypertext Markup Language )

    The HTML destination produces HTML 3.2-compatible output. You can, however, produce (HTML 4 stylesheet) output using the HTML4 tagsets.

    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.

  • The body file is required with all ODS HTML output. 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 on-line use, not for printing. To print hard-copies of the output objects, use the PRINTER destination.

  • Markup Languages (MARKUP) Family

    Just as table definitions describe how to lay out a table, and style attributes describe the style of the output, tagsets describe how to produce a markup language output. You can use a tagset that SAS supplies or you can create your own using the TEMPLATE procedure. Like table definitions and style attributes, tagsets enable you to modify your markup language output. For example, each variety of XML can be specified 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 a tagset that SAS supplies or a customized tagset that you created without having to wait for the next release of SAS. With the addition of modifying and creating your own tagsets by using PROC TEMPLATE, now you have 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 listing of the markup language tagsets that SAS supplies, see the section on listing tagset names in the The Complete Guide to the SAS Output Delivery System . To learn how to define your own tagsets, see the section on methods to create your own tagsets in the The Complete Guide to the SAS Output Delivery System .

    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.

  • PRINTER Family

    The PRINTER destination produces output for

    • 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 contain 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. While there are other applications that can read RTF files, 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," meaning that SAS does not determine the optimal place to position each item on the page. For example, page breaks are not always fixed, so when you edit your text, you do not want your RTF output tables to split at inappropriate places. Your tables can remain whole and intact on one page or can have logical breaks where you specified.

    However, 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, all the column widths can be set properly by SAS and the table can be divided into panels if it is too wide to fit on a single page.

    In short, when producing RTF output for input to Microsoft Word, SAS determines the horizontal measurement and Microsoft Word controls the vertical measurement. Because Microsoft Word can determine how much room there is on the page, your tables will display consistently as you specified even after you modified your RTF file.

What Controls 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 stylesheets for HTML.

  2. Features that are global to the document, such as AUTHOR and table of contents generation.

  3. Features that we expect users to change on each document, such as the output file name.

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. For more information about using each destination, see the topic on ODS statements in the The Complete Guide to the SAS Output Delivery System .

By default, the LISTING destination is open and all other destinations are closed. Consequently, if you do nothing, your SAS programs run and produce listing output looking just as they did in previous releases of SAS before ODS was available.

What Are Table Definitions, Table Elements, and Table Attributes?

A table definition describes how to generate the output for a tabular output object. (Most ODS output is tabular.) A table definition determines the order of column headers and the order of variables , as well the overall look of the output object that uses it. For information about customizing the table definition, see the topic on the TEMPLATE procedure in the The Complete Guide to the SAS Output Delivery System .

In addition to the parts of the table definition that order the headers and columns, each table definition contains or references table elements . A table element is a collection of table attributes that apply to a particular header, footer, or column. Typically, a table attribute specifies something about the data rather than about its presentation. For example, FORMAT specifies the SAS format, such as the number of decimal places. However, some table attributes describe presentation aspects of the data, such as how many blank characters to place between columns.

Note: The attributes of table definitions that control the presentation of the data have no effect on output objects that go to the LISTING or OUTPUT destination. However, the attributes that control the structure of the table and the data values do affect listing output.

For information on table attributes, see the section on table attributes in the The Complete Guide to the SAS Output Delivery System .

What Are Style Definitions, Style Elements, and Style Attributes?

To customize the output at the level of your entire output stream in a SAS session, you specify a style definition. A style definition describes how to generate the presentation aspects (color, font face, font size, and so on) of the entire SAS output. A style definition determines the overall look of the documents that use it.

Each style definition is composed of style elements . A style element is a collection of style attributes that apply to a particular part of the output. For example, a style element may contain instructions for the presentation of column headers, or for the presentation of the data inside the cells . Style elements may also specify default colors and fonts for output that uses the style definition.

Each style attribute specifies a value for one aspect of the presentation. For example, the BACKGROUND= attribute specifies the color for the background of an HTML table or for a colored table in printed output. The FONT_STYLE= attribute specifies whether to use a Roman or an italic font. For information on style attributes, see the section on style attributes in the The Complete Guide to the SAS Output Delivery System .

Note: Because style definitions control the presentation of the data, they have no effect on output objects that go to the LISTING or OUTPUT destination.

What Style Definitions Are Shipped with SAS Software?

Base SAS software is shipped with many style definitions. To see a list of these styles, you can view them in the SAS Explorer Window, use the TEMPLATE procedure, or use the SQL procedure.

  • SAS Explorer Window:

    To display a list of the available styles using the SAS Explorer Window, follow these steps:

    1. From any window in an interactive SAS session, select View Results

    2. In the Results window, select View Templates

    3. In the Templates window, select and open Sashelp.tmplmst .

    4. Select and open the Styles folder, which contains a list of available style definitions. If you want to view the underlying SAS code for a style definition, then select the style and open it.

      Operating Environment Information: For information on navigating in the Explorer window without a mouse, see the section on Window Controls and General Navigation in the SAS documentation for your operating environment.

  • TEMPLATE Procedure:

    You can also display a list of the available styles by submitting the following PROC TEMPLATE statements:

     proc template;     list styles;  run; 
  • SQL Procedure:

    You can also display a list of the available styles by submitting the following PROC SQL statements:

     proc sql;  select * from styles.  style-name  ; 

    The style “name is the name of any style from the template store (for example, styles.default or styles.beige ).

For more information on how ODS destinations use styles and how you can customize styles, see the section on the DEFINE STYLE statement in the The Complete Guide to the SAS Output Delivery System .

How Do I Use Style Definitions with Base SAS Procedures?

  • Most Base SAS Procedures

  • Most Base SAS procedures that support ODS use one or more table definitions to produce output objects. These table definitions include definitions for table elements: columns, headers, and footers. Each table element can specify the use of one or more style elements for various parts of the output. These style elements cannot be specified within the syntax of the procedure, but you can use customized styles for the ODS destinations that you use. For more information about customizing tables and styles, see the TEMPLATE procedure in the The Complete Guide to the SAS Output Delivery System .

  • The PRINT, REPORT and TABULATE Procedures

  • The PRINT, REPORT and TABULATE procedures provide a way for you to access table elements from the procedure step itself. Accessing the table elements enables you to do such things as specify background colors for specific cells, change the font face for column headers, and more. The PRINT, REPORT, and TABULATE procedures provide a way for you to customize the markup language and printed output directly from the procedure statements that create the report. For more information about customizing the styles for these procedures, see the Base SAS Procedures Guide .

Changing SAS Registry Settings for ODS

Overview of ODS and the SAS Registry

The SAS registry is the central storage area for configuration data that ODS uses. This configuration data is stored in a hierarchical form, which works in a similar manner to the way directory-based file structures work under UNIX, Windows, VMS, and the z/OS UNIX system. However, the SAS registry uses keys and subkeys as the basis for its structure, instead of using directories and subdirectories, like similar file systems in DOS or UNIX. A key is a word or a text string that refers to a particular aspect of SAS. Each key may be a place holder without values or subkeys associated with it, or it may have many subkeys with associated values. For example, the ODS key has DESTINATIONS, GUI, ICONS, and PREFERENCES subkeys. A subkey is a key inside another key. For example, PRINTER is a subkey of the DESTINATIONS subkey .

click to expand
Display 2.5: SAS Registry of ODS Subkeys

Changing Your Default HTML Version Setting

By default, the SAS registry is configured to generate HTML4 output when you specify the ODS HTML statement. To permanently change the default HTML version, you can change the setting of the HTML version in the SAS registry.

CAUTION:

If you make a mistake when you modify the SAS registry, then your system might become unstable or unusable. You will not be warned if an entry is incorrect. Incorrect entries can cause errors, and can even prevent you from bringing up a SAS session. For more information about how to configure the SAS registry, see the SAS registry section in SAS Language Reference: Concepts .

To change the default setting of the HTML version in the SAS registry:

  1. Select Solutions Accessories Registry Editor or

    Issue the command REGEDIT .

  2. Select ODS Default HMTL Version

  3. Select Edit Modify or

    Click the right mouse button and select MODIFY . The Edit String Value window appears.

  4. Type the HTML version in the Value Data text box and select OK .

click to expand
Display 2.6: SAS Registry Showing HTML Version Setting

Changing ODS Destination Default Settings

ODS destination subkeys are stored in the SAS registry. To change the values for these destinations subkeys:

  1. Select ODS Destinations

  2. Select a destination subkey

  3. Select a subkey in the Contents of window

  4. Select Edit Modify or

    Click the right mouse button and select MODIFY .

  5. Type in the Value Data entry into the Edit Value String or Edit Signed Integer Value window and select OK .

    click to expand
    Display 2.7: Registry Editor Window

Customized ODS Output

SAS Output

By default, ODS output is formatted according to instructions that a PROC step or DATA step defines. However, ODS provides ways for you to customize the output. You can customize the output for an entire SAS job, or you can customize the output for a single output object.

Selection and Exclusion Lists

You can specify which output objects that you want to produce by selecting or excluding them in a list. For each ODS destination, ODS maintains either a selection list or an exclusion list. A selection list is a list of output objects that are sent to the destination. An exclusion list is a list of output objects that are excluded from the destination. ODS also maintains an overall selection list or an overall exclusion list. You can use these lists to control which output objects go to the specified ODS destinations.

To see the contents of the lists use the ODS SHOW statement. The lists are written to the SAS log. The following table shows the default lists:

Table 2.5: Default List for Each ODS Destination

ODS Destination

Default List

OUTPUT

EXCLUDE ALL

All others

SELECT ALL

How Does ODS Determine the Destinations for an Output Object?

To specify an output object, you need to know which output objects your SAS program produces. The ODS TRACE statement writes to the SAS log a trace record that includes the path, the label, and other information about each output object that is produced. For more information, about the ODS TRACE statement see The Complete Guide to the SAS Output Delivery System . You can specify an output object as any of the following:

  • a full path. For example,

     Univariate.City_Pop_90.TestsForLocation 

    is the full path of the output object.

  • a partial path. A partial path consists of any part of the full path that begins immediately after a period (.) and continues to the end of the full path. For example, if the full path is

     Univariate.City_Pop_90.TestsForLocation 

    then the partial paths are:

     City_Pop_90.TestsForLocation  TestsForLocation 
  • a label that is enclosed in quotation marks.

    For example,

     "Tests For Location" 
  • a label path. For example, the label path for the output object is "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location"

    Note: The trace record shows the label path only if you specify the LABEL option in the ODS TRACE statement.

  • a partial label path. A partial label path consists of any part of the label that begins immediately after a period (.) and continues to the end of the label. For example, if the label path is

     "The UNIVARIATE Procedure"."CityPop_90"."Tests For Location" 

    then the partial label paths are:

     "CityPop_90"."Tests For Location"  "Tests For Location" 
  • a mixture of labels and paths.

  • any of the partial path specifications, followed by a pound sign (#) and a number. For example, TestsForLocation#3 refers to the third output object that is named TestsForLocation.

As each output object is produced, ODS uses the selection and exclusion lists to determine which destination or destinations the output object will be sent to. The following figure illustrates this process:

For each destination, ODS first asks if the list for that destination includes the object. If it does not, ODS does not send the output object to that destination. If the list for that destination does include the object, ODS reads the overall list. If the overall list includes the object, ODS sends it to the destination. If the overall list does not include the object, ODS does not send it to the destination.

click to expand
Figure 2.2: Directing an Output Object to a Destination

Note: Although you can maintain a selection list for one destination and an exclusion list for another, it is easier to understand the results if you maintain the same types of lists for all the destinations where you route output.

Customized Output for an Output Object

For a procedure, the name of the table definition that is used for an output object comes from the procedure code. The DATA step uses a default table definition unless you specify an alternative with the TEMPLATE= suboption in the ODS option in the FILE statement. For more information, see the section on the TEMPLATE= suboption in the The Complete Guide to the SAS Output Delivery System .

To find out which table definitions a procedure or the DATA step uses for the output objects, you must look at a trace record. To produce a trace record in your SAS log, submit the following SAS statements:

 ods trace on;  your-proc-or-DATA-step  ods trace off; 

Remember that not all procedures use table definitions. If you produce a trace record for one of these procedures, no definition appears in the trace record. Conversely, some procedures use multiple table definitions to produce their output. If you produce a trace record for one of these procedures, more than one definition appears in the trace record.

The trace record refers to the table definition as a template. For a detailed explanation of the trace record, see the section on the ODS TRACE statement in the The Complete Guide to the SAS Output Delivery System .

You can use PROC TEMPLATE to modify an entire table definition. When a procedure or DATA step uses a table definition, it uses the elements that are defined or referenced in its table definition. In general, you cannot directly specify a table element for your procedure or DATA step to use without modifying the definition itself.

Note: Three Base SAS procedures, PROC PRINT, PROC REPORT and PROC TABULATE, do provide a way for you to access table elements from the procedure step itself. Accessing the table elements enables you to customize your report. For more information about these procedures, see the Base SAS Procedures Guide

Summary of ODS

In the past, the term output has generally referred to the outcome of a SAS procedure and DATA step. With the advent of the Output Delivery System, output takes on a much broader meaning. ODS is designed to optimize output from SAS procedures and the DATA step. It provides a wide range of formatting options and greater flexibility in generating, storing, and reproducing SAS output.

Important features of ODS include the following:

  • ODS combines raw data with one or more table definitions to produce one or more output objects . An output object tells ODS how to format the results of a procedure or DATA step.

  • ODS provides table definitions that define the structure of the output from SAS procedures and from the DATA step. You can customize the output by modifying these definitions, or by creating your own definitions.

  • ODS provides a way for you to choose individual output objects to send to ODS destinations.

  • ODS stores a link to each output object in the Results folder for easy retrieval and access.

  • As future destinations are added to ODS, they will automatically become available to the DATA step and all procedures that support ODS.

One of the main goals of ODS is to enable you to produce output for numerous destinations from a single source, without requiring separate sources for each destination. ODS supports many destinations:

DOCUMENT

  • enables you to capture output objects from single run of the analysis and produce multiple reports in various formats whenever you want without re-running your SAS programs.

LISTING

  • produces output that looks the same as the traditional SAS output.

HTML

  • produces output for online viewing.

MARKUP

  • produces output for markup language tagsets.

OUTPUT

  • produces SAS output data sets, thereby eliminating the need to parse PROC PRINTTO output.

PRINTER

  • produces presentation-ready printed reports.

RTF

  • produces output suitable for Microsoft Word reports.

By default, ODS output is formatted according to instructions that the procedure or DATA step defines. However, ODS provides ways for you to customize the presentation of your output. You can customize the presentation of your SAS output, or you can customize the look of a single output object. ODS gives you greater flexibility in generating, storing, and reproducing SAS procedure and DATA step output with a wide range of formatting options.




Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

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