Routing and Customizing SAS Output

Default Output Destination

Definition

The destination in SAS is a designation that the Output Delivery System (ODS) uses to generate a specific type of output. Or, simply put, it is how and where ODS routes your output. For example, ODS can route your output to a browser as HTML, to a file, or to your terminal or display as a simple list report. The destination of your output depends on the following:
  • your operating environment
  • your mode of running SAS
  • your version of SAS

Default Destinations

In SAS 9.3, when running SAS in windowing mode in the Microsoft Windows and UNIX operating environments, output is sent by default to the HTML destination; the LISTING destination is no longer the default destination. Also, ODS Graphics is turned on by default when running SAS 9.3 in the windowing environment under the UNIX and Windows operating systems.
For running SAS in batch mode, however, LISTING is still the default destination for SAS 9.3 and earlier versions, and ODS Graphics is turned off by default. See Default Destinations for Output in SAS 9.3 and 9.2 for a comparison of output destinations based on SAS version and operating mode. Your defaults might be different due to your registry or configuration file settings.
The following table shows the default destinations for each method of operation based on SAS version:
Default Destinations for Output in SAS 9.3 and 9.2
SAS Version
Mode of Running SAS
Viewer
ODS Destination
SAS 9.3
windowing mode
SAS Results Viewer or browser window
HTML
interactive line mode
terminal display
LISTING
noninteractive mode
depends on operating environment
batch mode
depends on operating environment:
SAS 9.2
windowing mode
SAS Output Window
LISTING
interactive line mode
terminal display
LISTING
noninteractive mode
depends on operating environment
batch mode
depends on operating environment
Operating Environment Information: The default destination for SAS output is specific to your operating environment. Your configuration file and registry settings also affect the where your output is sent. For specific information about the default output destination, see the SAS documentation for your operating environment:
For more information about the new defaults and ODS destinations, see the SAS Output Delivery System: User's Guide.

Changing the Output Destination

Overview

With SAS, there are many ways to control where your log, procedure, and DATA step output is sent. The method that you use depends on your operating system and the mode in which you are running SAS. See Changing the Output Destination for a list of commonly used methods for changing the output destination. You can route your output directly to a PC or terminal display, to a printer, or to an external file using SAS procedures, system options, commands, statements, and global ODS statements.

Using ODS to Change the Output Destination

Before ODS was introduced in SAS 7, most procedures generated output that was designed for a traditional line-printer and the output went straight to the listing window as a simple list report. If you wanted to change the destination of your output, you used methods such as PROC PRINTTO and the FILENAME statement. While these methods are useful, there are many more options available with ODS for controlling output. ODS destination statements enable you to specify a variety of formats and destinations.
The following list describes some of the commonly used ODS statements and other SAS language elements that are used for routing output.
Changing the Output Destination
Method to Use
Output Result
routes DATA step, log, or procedure output from the system default destinations to the destination that you choose. The PRINTTO procedure defines non-ODS destinations.
associates a fileref with an external file or output device and enables you to specify file and device attributes
stores the contents of the LOG or OUTPUT windows in files that you specify, when the command is issued from within the windowing environment.
opens, manages, or closes the LISTING destination.
produces a SAS data set from an output object and manages the selection and exclusion lists for the OUTPUT destination.
produces and ODS document that enables you to restructure, navigate, and replay your data in different ways. It also enables you to specify multiple destinations without needing to rerun your analysis or repeat your database query.
opens, manages, or closes the HTML destination, which produces HTML 4.0 output that contains embedded style sheets.
opens, manages, or closes the MARKUP destination, which produces SAS output that is formatted using one of many different markup languages.
opens, manages, or closes the PDF destination, which produces PDF output, a form of output that is read by Adobe Acrobat and other applications.
opens, manages, or closes the RTF destination, which produces output written in Rich Text Format for use with Microsoft Word 2002.
redefine the destination of log and output for an entire SAS program. These system options are specified when you invoke SAS. The system options used to route output are the ALTLOG=, ALTPRINT=, LOG=, and PRINT= options.
For conceptual information about global ODS statements, see the following resources:
Operating Environment Information:
For information about changing the default output location for the z/OS and UNIX operating environments, see the following resources:

Customizing Output

Making Output Descriptive

There are many statements and system options available in SAS that enable you to customize your output. You can add informative titles, footnotes, and labels to customize your output and control how the information is laid out on the page.
The following list describes some of the statements and SAS system options that you can use:
Methods for Making Output Descriptive
SAS Language Element
Function
CENTER | NOCENTER system option
controls whether output is centered. By default, SAS centers titles and procedure output on the page and on the personal computer display.
DATE | NODATE system option
controls printing of date and time values. When this option is enabled, SAS prints on the top of each page of output the date and time the SAS job started. When you run SAS in interactive mode, the date and time the job started is the date and time that you started your SAS session.
FOOTNOTE statement
prints footnotes at the bottom of each output page. You can also use the FOOTNOTES window for this purpose.
FORMCHAR=
specifies the default output formatting characters for some procedures such as CALENDAR, FREQ, REPORT, and TABULATE.
FORMDLIM=
specifies the default output formatting characters for some procedures such as CALENDAR, FREQ, REPORT, and TABULATE.
LABEL statement
associates descriptive labels with variables. With most procedure output, SAS writes the label rather than the variable name.
The LABEL statement also provides descriptive labels when it is used with certain SAS procedures. See Base SAS Procedures Guide for information about using the LABEL statement with a specific procedure.
LINESIZE= and PAGESIZE= system options
change the default number of lines per page (page size) and characters per line (line size) for printed output. The default depends on the method of running SAS and the settings of certain SAS system options. Specify new page and line sizes in the OPTIONS statement or OPTIONS window. You can also specify line and page size for DATA step output in the FILE statement.
The values that you use for the LINESIZE= and PAGESIZE= system options can significantly affect the appearance of the output that is produced by some SAS procedures.
NUMBER | NONUMBER and PAGENO= system options
control page numbering. The NUMBER system option controls whether the page number prints on the first title line of each page of printed output. You can also specify a beginning page number for the next page of output produced by SAS by using the PAGENO= system option.
global ODS statements
enable you to apply styles to your output or to use a style or table definition.
TITLE statement
prints titles at the top of each output page. By default, SAS prints the following title: The SAS System
You can use the TITLE statement or TITLES window to replace the default title or specify other descriptive titles for SAS programs. You can use the null title statement (title;) to suppress a TITLE statement.

Using ODS to Customize the Style and Structure of Output

ODS does more than just enable you to control output destinations. It also enables you to customize the structure and style of your output. Since ODS uses table and style templates (definitions) to display procedure and DATA step results, you can control these results by creating customized table and style definitions. You can also modify existing style and table definitions if you do not want to create the definitions from scratch.
Below are some resources related to creating style and table definitions with ODS:

Reformatting Values in Output

Certain SAS statements, procedures, and options enable you to print values using specified formats. In a windowing environment, you can use the Properties window to control how values are displayed. You can apply or change formats with the FORMAT and ATTRIB statements, or with the Properties window in a windowing environment.
The FORMAT procedure enables you to design your own formats and informats, giving you added flexibility in displaying values. See FORMAT Procedure in Base SAS Procedures Guide for more information about the FORMAT procedure, and SAS System Options: Reference for information about all other SAS system options.

Printing Missing Values

SAS represents ordinary missing numeric values in a SAS listing as a single period and missing character values as a blank space. If you specify special missing values for numeric variables, SAS writes the letter or the underscore. For character variables, SAS writes a series of blanks equal to the length of the variable.
The MISSING= system option enables you to specify a character to print in place of the period for ordinary missing numeric values. For more information, see the MISSING= System Option in SAS System Options: Reference.