Statistical Graphics Using ODS |
Specifying an ODS Destination for Graphics |
If you do not specify an ODS destination, then the LISTING destination is used by default. Here is an example of how you can 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 file name. 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 |
PRINTER |
|
PS |
PRINTER |
RTF |
You can close the LISTING destination if you are only interested in displaying your output in a different 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 listing 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 otherwise 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;
You can specify a file name 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 startup, 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 file name for your output, then the SAS System provides a default file name, 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 file names for each destination are specified in the SAS Registry. For example, Figure 21.31 shows that the default file name in the SAS Registry for the RTF destination is sasrtf.rtf. For more information, see the SAS Companion for your operating system.
Copyright © SAS Institute, Inc. All Rights Reserved.