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 before invoking your procedure, as illustrated in the examples beginning in the section 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 to request 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, your system options, and your 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. For more information, see the SAS Output Delivery System: User's Guide.


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 that is displayed in a graph is always antialiased. Antialiasing is very time-consuming for larger graphs, and its benefits decrease as the number of points increases, so it is disabled by default for plots that have many points. If the number of graph elements exceeds the ANTIALIASMAX= threshold (4,000 by default), then antialiasing is not used, even if you specify ANTIALIAS=ON. By default, ANTIALIAS=ON.


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


specifies the priority for cycling group attributes.


cycles through the lists of colors while holding the marker symbol and line pattern constant. When all the colors are exhausted, the marker symbol and line style attributes increment to the next element, and then the colors in the list are repeated.


simultaneously cycles through colors, marker symbols, and line patterns.

You can specify ATTRPRIORITY=COLOR or ATTRPRIORITY=NONE in the ODS GRAPHICS statement to change the attribute priority for all graphs. You can specify ATTRPRIORITY=COLOR or ATTRPRIORITY=NONE in the BEGINGRAPH statement in the GTL to change the attribute priority for individual graphs. The default attribute priority is set by the ATTRPRIORITY="Color" or ATTRPRIORITY="None" option in the CLASS GRAPH statement in each style.


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


specifies how the BY-group line is displayed in graphs when the analysis contains 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. Most graph templates control the placement of the BY line 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. Because 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. By default, 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. By default, 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 filename 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 that have labels, then no points are labeled. By default, LABELMAX=200.


specifies the maximum percentage of the overall graph area that a legend can occupy. By default, 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 format), PBM (portable bitmap), PCD (Photo CD), PCL (Printer Command Language), PDF (portable document format), PICT (QuickDraw picture format), PNG (Portable Network Graphics), PS (PostScript image file format), SVG (Scalable Vector Graphics format), 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. RESET and RESET=ALL are equivalent. If you want to reset more than one option, but not all the options, then you must specify RESET= separately for each option that you reset (for example, ods graphics on / reset=antialias reset=index;). The RESET= options include the following:


resets all 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 to the size of the graph. By default, SCALE=ON. For examples, see FigureĀ 21.73 and FigureĀ 21.74.


specifies whether markers are scaled in nested layouts. By default, SCALEMARKERS=ON.


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


specifies the width of the graph. By default, WIDTH=640PX (640 pixels). You can also specify width in inches (for example, WIDTH=5IN) or centimeters (for example, WIDTH=12CM).