Specifying an ODS Destination for Graphics

If you do not specify an ODS destination, then either the LISTING or the HTML destination is used by default. Here is an example of how you can explicitly specify the HTML destination:

ods graphics on;
ods html;

proc reg data=sashelp.class;
   model Weight = Height;
run; quit;

ods html close;

This ODS HTML statement creates an HTML file with a default name. See the section Specifying a File for ODS Output to see how to specify a filename. Other destinations are specified in a similar way. For example, you can specify an RTF destination with the following statements:

ods graphics on;
ods rtf;

. . .

ods rtf close;

The destinations that ODS supports for graphics are as follows:

Destination

Destination Family

DOCUMENT

 

HTML

MARKUP

LATEX$^*$

MARKUP

LISTING

 

PCL

PRINTER

PDF

PRINTER

PS

PRINTER

RTF

 

* The LATEX destination is experimental.

You can close all open destinations if you are interested only in displaying your output in a nondefault destination. For example, if you want to see your output only in the RTF destination, you can specify the following statements:

ods graphics on;
ods _all_ close;
ods rtf;

. . .

ods rtf close;
ods listing;

Closing unneeded destinations makes your jobs run faster and creates fewer files. More generally, it makes your jobs consume fewer resources, because a graph is created for every open destination. The last statement opens the LISTING destination after you are finished using the RTF destination.

You can also use the ODS OUTPUT destination to create an output data set from the data object used to make a plot. Here is an example:

ods graphics on;

proc reg data=sashelp.class;
   ods output fitplot=myfitplot;
   model Weight = Height;
run; quit;

Specifying a File for ODS Output

You can specify a filename for your output with the FILE= option in the ODS destination statement, as in the following example:

ods html file="test.htm";

The output is written to the file test.htm, which is saved in the SAS current folder. At start-up, the SAS current folder is the same directory in which you started your SAS session. If you are using the SAS windowing environment, then the current folder is displayed in the status line at the bottom of the main SAS window. If you do not specify a filename for your output, then the SAS System provides a default filename, which depends on the ODS destination. This file is saved in the SAS current folder. You can always check the SAS log to verify the name of the file in which your output is saved. For example, suppose you specify the following statement:

ods html;

Then the following message is displayed in the SAS log:

   NOTE: Writing HTML Body file: sashtml.htm

The default filenames for each destination are specified in the SAS Registry. For example, Figure 21.60 shows that the default filename in the SAS Registry for the RTF destination is sasrtf.rtf. For more information, see the SAS Companion for your operating system.