Statistical Graphics Using ODS


  • ODS GRAPHICS <OFF | ON> </ options>;

The ODS GRAPHICS statement enables ODS to create graphs. You can enable ODS Graphics by using either of the following equivalent statements:

ods graphics on;
ods graphics;

You specify one of these statements prior to your procedure invocation, as illustrated in the examples beginning with Default Plots for Simple Linear Regression with PROC REG. Any procedure that supports ODS Graphics then produces graphs, either by default or when you specify procedure options for requesting particular graphs.

To disable ODS Graphics, specify the following statement:

ods graphics off;

ODS Graphics might or might not be enabled by default depending on your operating system, whether you are in the SAS windowing environment, your registry, system options, and configuration file settings. For more information about default settings and enabling and disabling ODS Graphics, see the section Enabling and Disabling ODS Graphics.

The following is a subset of the options, syntax, and capabilities available in the ODS GRAPHICS statement. See the SAS Output Delivery System: User's Guide for more information.


controls the use of antialiasing to smooth the components of a graph. Without antialiasing, pixels are simply set or not set. With antialiasing, pixels at the edge of a line or other object are set to an intermediate color, which makes smoother and more professional looking graphics. Text displayed in a graph is always antialiased. Antialiasing is very time-consuming for larger graphical displays, and its benefits decrease as the number of points increases, so it is disabled by default for plots with many points. If the number of observations in the ODS output object exceeds the ANTIALIASMAX= threshold (10,000 by default), then antialiasing is not used, even if you specify the option ANTIALIAS=ON. The default is ANTIALIAS=ON.


specifies the maximum number of markers or lines to be antialiased before antialiasing is disabled. For example, if there are more than 10,000 point markers and ANTIALIASMAX=10,000 (the default), then no markers are antialiased.


specifies whether to draw the graph with a border. BORDER=ON is the default.


specifies how the BY group line is displayed in graphs when the analysis is run with a BY statement. By default, a BY line is not displayed. Specify BYLINE=FOOTNOTE (recommended) to display the BY line as a left-justified graph footnote or BYLINE=TITLE (not recommended) to display the BY line as a centered graph title. The placement of the BY line is controlled in each graph template as follows:

if (_BYTITLE_)
   entrytitle _BYLINE_ / textattrs=GraphValueText;
   if (_BYFOOTNOTE_)
      entryfootnote halign=left _BYLINE_;

You can modify the graph template if you want the BY line to be displayed in some other way. Since most graphs have titles and few graphs have footnotes, the BY line looks better when it is displayed as a footnote.


specifies the height of the graph. The default is HEIGHT=480PX (480 pixels). You can also specify height in inches (for example, HEIGHT=5IN) or centimeters (for example, HEIGHT=12CM).


controls tooltip generation in the HTML destination. The default is IMAGEMAP=OFF, which means that no tooltips are generated. Tooltips are text boxes that appear in HTML output when you rest your mouse pointer over a part of the plot (see Example 21.1).


specifies the base image filename. The default is the name of the output object. You can determine the name of the output object by using the ODS TRACE statement (see the section Determining Graph Names and Labels). The base image name should not include an extension. ODS automatically adds the increment value and the appropriate extension (which is specific to the output destination). See the section Specifying Base Filenames for an example.


specifies the maximum number of labeled areas before labeling is disabled. For example, if LABELMAX=50, and there are more than 50 points with labels, then no points are labeled. The default is LABELMAX=200.


specifies the maximum percentage of the overall graph area that a legend can occupy. The default is MAXLEGENDAREA=20. Larger legends are dropped from the display.

OUTPUTFMT=<image-file-type | STATIC>

specifies the image format for graphs. The OUTPUTFMT= option was previously named the IMAGEFMT= option. By default, OUTPUTFMT=STATIC and ODS dynamically uses the best quality static image format for the active output destination. The available image formats include: BMP (Microsoft Windows device-independent bitmap), DIB (Microsoft Windows device-independent bitmap), EMF (Microsoft NT enhanced metafile), EPSI (Adobe encapsulated PostScript interchange), GIF (graphic interchange format), JFIF (JPEG file interchange format), JPEG (Joint Photographic Experts Group), PBM (portable bitmap), PCD (Photo CD), PCL (Printer Command Language), PDF (portable document format), PICT (the QuickDraw picture format), PNG (Portable Network Graphics), PS (PostScript image file format), SVG (Scalable Vector Graphics), TIFF (Tagged Image File Format), WMF (Microsoft Windows Metafile format), XBM (X Bitmap), and XPM (X-Windows Pixelmap). If the specified image format is not valid for the active output destination, the device is automatically remapped to the default image format.


resets one or more ODS GRAPHICS options to their default settings. The RESET and RESET=ALL options are equivalent. If you want to reset more than one option, but not all of the options, then you must specify RESET= separately for each option you reset (for example, ods graphics on / reset=antialias reset=index;). The RESET= options include the following:


resets all of the resettable options to their defaults.


resets the ANTIALIAS= option to its default.


resets the ANTIALIASMAX= option to its default.


resets the BORDER= option to its default.


resets the index counter that is appended to static image files.


resets the HEIGHT= option to its default.


resets the IMAGEMAP= option to its default.


resets the LABELMAX= option to its default.


resets the SCALE= option to its default.


resets the TIPMAX= option to its default.


resets the WIDTH= option to its default.


specifies whether the fonts and symbol markers are scaled proportionally with the size of the graph. The default is SCALE=ON. For examples, see Figure 21.58 and Figure 21.59.


specifies whether markers are scaled in nested layouts. The default is SCALE=ON.


specifies the maximum number of distinct tooltips permitted before tooltips are disabled. Tooltips are text boxes that appear when you rest your mouse pointer over a part of the plot. For example, if TIPMAX=400, and there are more than 400 points in a scatter plot, then no tooltips appear. The default is TIPMAX=500.


specifies the width of the graph. The default is WIDTH=640PX (640 pixels). You can also specify widths in inches (for example, WIDTH=5in) or centimeters (for example, WIDTH=12cm).