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 templates. You can also modify
existing style and table definitions if you do not want to create the definitions from
scratch.
For information about the Output Delivery System, see SAS Output Delivery System:
Users Guide.
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.
Sample SAS Output
Default HTML Output in the SAS Windowing Environment
Starting with SAS 9.3, the default destination is HTML when running SAS in the
windowing environment for the Windows and UNIX operating environments. The
default output is displayed in the SAS Results Viewer Window.
title 'Student Weight';
proc print data=sashelp.class;
where weight>100;
run;
quit;
162 Chapter 9 SAS Output
Output 9.1 Default HTML Output in the Windowing Environment
Note: At SAS start-up, unless you have previously closed the HTML destination, output
is sent to the WORK directory by default. If you close the HTML destination and re-
open it in the same SAS session, all output goes to the current directory rather than
the WORK directory. You do not have to specify ODS HTML CLOSE; to view your
output.
Traditional SAS LISTING Output in the SAS Windowing
Environment
If you are running SAS in windowing mode and want to send your output to the
LISTING destination, you can use ODS statements in your SAS programs to change the
destination. If you want a more permanent solution, you can change your settings so that
every time you run SAS, your output is sent to the LISTING destination by default. For
information about how to change these settings, see “Default HTML Output” in SAS
Output Delivery System: Users Guide.
In this example, the output destination is changed from HTML to LISTING by
specifying the ODS LISTING and ODS HTML CLOSE statements. By changing the
output destination to LISTING, the output is automatically displayed as a list report in
the SAS Output Window.
ods html close;
ods listing;
options nodate;
title 'Students';
Sample SAS Output 163

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.