ODS GRAPHICS Statement

Enables or disables ODS Graphics processing and sets graphics environment options. This statement affects ODS template-based (ODS Graphics) graphics only. The ODS GRAPHICS statement does not affect device-based graphics (SAS/GRAPH).
Valid in: Anywhere
Category: ODS: Output Control
Default: ON
Interaction: SAS/GRAPH device-based global statements such as GOPTIONS, SYMBOL, PATTERN, AXIS, and LEGEND do not affect template-based graphics. The ODS GRAPHICS statement does not affect device-based graphics.
Note: Beginning with SAS 9.3, ODS Graphics is enabled by default in the UNIX and Windowing environments.
See: For information about common tasks for managing ODS Graphics output, see SAS Graph Template Language: User's Guide.

Syntax

ODS GRAPHICS <OFF | ON> </ option(s)> ;

Summary of Optional Arguments

Specify whether anti-aliasing is applied to the rendering of the line and markers in any graph
Specify the maximum number of observations before anti-aliasing is disabled
Specify whether to draw a border around each graph
Specify the maximum number of discrete values to be shown in any graph
Specify the maximum number of group values to be shown in any graph
Specify the height of any graph
Specify whether data tips are generated
Specify the base image filename
Specify the maximum number of labeled areas before labeling is disabled
Specify an integer that is interpreted as the maximum percentage of the overall graphics area that a legend can occupy
Specify the output format used to generate image or vector graphic files
Specify the maximum number of cells in a graph panel where the number of cells is determined dynamically by classification variables
Reset one or more ODS GRAPHICS options to its default
Specify whether the content of any graph is scaled proportionally
Specify whether the plot markers are to be scaled with the graph size
Specify the maximum number of distinct mouse-over areas allowed before data tips are disabled
Specify the width of any graph

Without Arguments

If the ODS automatic graphic capabilities are currently disabled, then specifying the ODS GRAPHICS statement without options enables them. If the ODS automatic graphic capabilities are currently enabled, then specifying the ODS GRAPHICS statement leaves them enabled.

Required Arguments

ON
enables ODS Graphics processing. This is the default if no argument is used.
Alias:YES
OFF
disables ODS Graphics processing.
Alias:NO

Optional Arguments

ANTIALIAS | NOANTIALIAS | ANTIALIAS= OFF | ON
specifies whether anti-aliasing is applied to the rendering of the line and markers in any graph. Anti-aliasing smooths the appearance of diagonal lines and some markers. Text displayed in the graph is always anti-aliased. For graphical displays that plot large numbers of points it is recommended that ANTIALIAS=OFF be specified for performance considerations.
ANTIALIAS= OFF | ON
specifies whether anti-aliasing is applied to the rendering of the line and markers in the graph.
OFF
does not smooth jagged edges of components other than text in the graph
Alias:NO
ON
smooths jagged edges of all components in the graph.
Alias:YES
ANTIALIAS
smooths jagged edges of all components in the graph.
NOANTIALIAS
does not smooth jagged edges of components other than text in the graph.
Default:ON
Restriction:If the number of markers or curve points in the plot exceeds the number specified by the ANTIALIASMAX= option, then the ANTIALIAS option is turned off. This is true even if you specify the option ANTIALIAS=ON or ANTIALIAS.
ANTIALIASMAX= n
specifies the maximum number of observations before anti-aliasing is disabled. For example, if there are more than 400 scatter point markers to be anti-aliased and ANTIALIASMAX=400, then no markers will be anti-aliased.
n
specifies a positive integer.
Default:600
BORDER= | BORDER | NOBORDER
specifies whether to draw a border around any graph.
BORDER= OFF | ON
specifies whether to draw the graph with a border on the outermost layout.
ON
specifies to draw a border around the graph.
Alias:YES
OFF
specifies not to draw a border around the graph.
Alias:NO
BORDER
specifies whether to draw a border around the graph.
NOBORDER
specifies not to draw a border around any graph.
Default:BORDER or BORDER=ON
DISCRETEMAX=n
specifies the maximum number of discrete values to be shown in any graph. Bar charts and box plots are examples of affected plot types. Scatter plots and other plot types can be affected if the data to be plotted is discrete or the axis is discrete.
n
specifies a positive integer.
Default:1000
Tips:Some plot layers might be unaffected by the DISCRETEMAX= option, and those layers will still be rendered. If all layers are affected, a blank graph will be rendered.

If the value specified by the DISCRETEMAX= option is exceeded by any plot layer in the graph, that layer will not be drawn and a warning message is issued.

GROUPMAX=n
specifies the maximum number of group values to be shown in any graph. Any graph that supports the GROUP= option is affected.
n
specifies a positive integer.
Default:1000
Tip: If the value specified by the GROUPMAX= option is exceeded by any plot layer in the graph, that layer will be rendered ignoring the GROUP= option and a warning message is issued.
HEIGHT=dimension
specifies the height of any graph.
dimension
is a nonnegative number.
Default:The value of the SAS registry entry "ODS > STATISTICAL GRAPHICS > Design Height" or the value of the DesignHeight= option in a STATGRAPH template. Typically, the value is 480px.
Tip:If only the HEIGHT= option is specified, then the default aspect of the graph is maintained.
IMAGEMAP= | IMAGEMAP | NOIMAGEMAP
controls data tips generation. Data tips are pieces of explanatory text that appear when you mouse-over the data portions of a graph contained in an HTML page.
IMAGEMAP= ON | OFF
controls data tips generation.
OFF
specifies not to generate data tips.
Alias:NO
ON
specifies to generate data tips.
Alias:YES
IMAGEMAP
specifies to generate data tips.
NOIMAGEMAP
specifies not to generate data tips.
Default:OFF or NOIMAGEMAP
Restriction:This option applies only when the ODS HTML destination is used.
IMAGENAME=”filename
specifies the base image filename.
If more than one image is generated, each is assigned filename as a base name followed by a number in order to create unique names. This numbering can be reset with the RESET=INDEX option. Path information (if needed) can be set with the GPATH= option on the ODS destination statement. The default path is the current output directory. A file extension for filename is automatically generated based on the OUTPUTFMT= option.
Default:The name of the output object.
Restriction: filename must be a single name. It must not include any path specification or image-format name extension.
Requirement:You must enclose filename in quotation marks.
LABELMAX= n
specifies the maximum number of labeled areas before labeling is disabled. For example, if there are more than 50 points to be labeled and LABELMAX=50, then no points will be labeled.
n
specifies a positive integer.
Default:200
Restriction:Data label collision avoidance is turned off under the following conditions:
  • The number of observations with nonmissing labels exceeds the value specified by LABELMAX=.
  • The number of observations exceeds five times the value specified by LABELMAX=.
A message is then sent to the SAS log.
Tip:To turn off collision avoidance specify LABELMAX=0.
MAXLEGENDAREA= n
specifies an integer that is interpreted as the maximum percentage of the overall graphics area that a legend can occupy.
n
specifies a positive integer.
Default:20
Tip:To turn off the legend, specify MAXLEGENDAREA=0. No warning will be issued when the legend is turned off in this way.
OUTPUTFMT= file–type | STATIC
specifies the format to be used. If the image or vector graphic format is not valid for the active output destination, the format is automatically changed to the default format for that destination.
file-type
is the image or vector graphic format to be generated. See Supported File Types for Output Destinations.
STATIC
uses the best quality static image format for the active output destination. This is the default.
Default:STATIC
PANELCELLMAX=n
specifies the maximum number of cells in a graph panel where the number of cells is determined dynamically by classification variables.
n
specifies a positive integer.
Default:10000
Tip:Graphs with DataPanel or DataLattice layouts are affected. If the value specified by the PANELCELLMAX= option is exceeded by either of these layouts, an empty graph will be rendered and a warning message is issued.
RESET | RESET= option
resets one or more ODS GRAPHICS options to its default.
RESET
resets alloptions to their defaults.
RESET=
resets one of the following to its default:
ALL
resets all reset-options to their defaults.
ANTIALIAS
resets the ANTIALIAS option to its default.
ANTIALIASMAX
resets the ANTIALIASMAX option to its default.
BORDER
resets the BORDER= option to its default.
IMAGEMAP
resets the IMAGEMAP= option to its default.
INDEX
resets the index counter that is appended to static image files.
HEIGHT
resets the HEIGHT= option to its default.
IMAGEMAP
resets the IMAGEMAP= option to its default.
Note:Not all output destinations support this feature.
LABELMAX
resets the LABELMAX= option to its default.
MAXLEGENDAREA=
resets the LABELMAX= option to its default.
SCALE
resets the SCALE= option to its default.
See:SCALE=
TIPMAX
resets the TIPMAX= option to its default.
WIDTH=
resets the WIDTH= option to its default.
SCALE= | SCALE | NOSCALE
specifies whether the content of any graph is scaled proportionally.
NOSCALE
does not scale the components of graph proportionally.
SCALE
scales the components of graph proportionally.
SCALE=
specifies whether the content of the graph is scaled proportionally.
OFF
does not scale the components of graph proportionally.
Aliases:NOSCALE

NO

ON
scales the components of graph proportionally.
Alias:YES
Default:ON or SCALE
SCALEMARKERS=YES | NO | ON | OFF
specifies whether the plot markers are to be scaled with the graph size. The scaling factor is based on the height of the graph cells and the height of the graph.
Default:ON
Restriction:Scaling is done only if the graph contains multiple cells or single nested cells.
TIPMAX=n
specifies the maximum number of distinct mouse-over areas allowed before data tips are disabled. For example, if there are more than 400 points in a scatterplot, and TIPMAX=400, then no data tips will appear.
n
specifies a positive integer.
Default:500
WIDTH=dimension
specifies the width of any graph.
dimension
is a nonnegative number.
Default:The value of the SAS registry entry "ODS > STATISTICAL GRAPHICS > Design Width" or the value of the DesignWidth= option in a STATGRAPH template. Typically, this value is 640px.
Tip:If only the WIDTH= option is specified, then the default aspect of the graph is maintained.

Details

Using the ODS GRAPHICS Statement

You can enable ODS Graphics by using either of the following equivalent statements:
ods graphics on;
ods graphics;
When you specify one of these statements before your procedure invocation, Base, SAS/STAT, SAS/ETS, and SAS/QC procedures support ODS Graphics, either by default, or when you specify procedure options for requesting particular graphs.
To disable ODS Graphics, specify the following statement:
ods graphics off; 
Note: For SAS/GRAPH procedures that use ODS Graphics (SGPLOT, SGPANEL, SGSCATTER, and SGRENDER), ODS Graphics is always ON and cannot be disabled. For other products, the initial state ODS Graphics is determined by a SAS Registry setting.

Using the ODS GRAPHICS Statement for Batch Jobs

To generate device-based graphics output in UNIX batch jobs, you must set the DISPLAY system option before creating the output. To set the display, enter the following command:
export DISPLAY=<ip_address>:0
The ip_address is the TCP/IP address, or the name of a UNIX terminal. Usually, the IP address of the UNIX system where SAS is running would be used. If you do not set the DISPLAY variable, then you get an error message in the SAS log.

Specifying the Image Name

For ODS Graphics output, by default, the ODS object name is used as the “root” name for the image output file. The following example creates a GIF image named REGPLOT:
ods graphics / imagename="regplot" outputfmt=gif;
The assigned name REGPLOT is treated as a "root" name and the first output created is named REGPLOT. Subsequent graphs are named REGPLOT1, REGPLOT2, and so on, with an increasing index counter. All graphs in this example will be GIF images.
If you are developing a template and it takes several submissions to get the desired output, try the RESET or RESET= option to force each output to replace itself:
ods graphics / reset=index ... ;
This specification causes all subsequent images to be created with the default or current image name

Specifying the Image Format

Each ODS destination uses a default format for its output. You can use the OUTPUTFMT= option in the ODS GRAPHICS statement to change the output format.
Note: Unless you have a special requirement for changing the image format, we recommend that you not change it. The default PNG or vector graphic format is far superior to other formats, such as GIF, in support for transparency and a large number of colors. Also, PNG and vector graphics images require much less disk storage space than JPEG or TIFF formats.
If you want to generate vector graphics images, you can use the following OUTPUTFMT= values for each destination:
ODS Destination
OUTPUTFMT=value
ODS LISTING
OUTPUTFMT=PS (for PostScript output)
OUTPUTFMT=PDF (for PDF output)
OUTPUTFMT=PCL (for PCL)
OUTPUTFMT=SVG
ODS HTML
OUTPUTFMT=SVG
ODS PDF
OUTPUTFMT=PDF (default)
ODS PCL
OUTPUTFMT=PCL (for PCL)
ODS PS
OUTPUTFMT=PS (for PostScript output)
ODS PRINTER
OUTPUTFMT=PS (for PostScript output)
OUTPUTFMT=PDF (for PDF output)
OUTPUTFMT=PCL (for PCL)
ODS RTF
IMAGEFMT=EMF
If a vector graphics image cannot be generated for the format that you specify, a PNG image is generated instead and is embedded in the specified output file. The output file format and extension are not changed in that case. In the following cases, a vector graphics image cannot be generated:
  • surface plots
  • bivariate histograms
  • graphs that use smooth gradient contours
  • graphs that include continuous legends
  • graphs that use data skins
  • graphs that use transparency (EMF and PS ODS destinations only)
  • graphs that contain one or more rotated images

Supported File Types for Output Destinations

The following table lists all of the supported file types for ODS output destinations.
Supported File Types for Output Destinations
Output Destination
Supported File Types
HTML
PNG (default), GIF, JPEG, JPG, PBM, SVG, EMF, BMP
LISTING
PNG (default), BMP, DIB, EMF, EPSI, GIF, JFIF, JPEG, JPG, PBM, PDF, PS, SASEMF, STATIC, TIFF, WMF, XBM, XPM, PSL, SVG
LATEX
PS (default), EPSI, GIF, PNG, PDF, JPG, PSL, EPS, EMF
PDF and PCL
SVG (default), JPEG, JPG, GIF, PSL, EPS, EPSI, PDF, PCL, PNG, EMF
PS
PNG (default), JPEG, JPG, GIF, PSL, EPS, EPSI, PDF, PCL, EMF
RTF
PNG(default), JPEG, JPG, JFIF, EMF
Markup Tagsets
All markup family tagsets have the default value built in.

Description of Supported File Types

The following table provides descriptions of the supported file types for ODS output destinations.
Description of Supported File Types
File Type
Description
BMP (Microsoft Windows Device Independent Bitmap)
Supports color-mapped and true color images that are stored as uncompressed or run-length encoded data. BMP was developed by Microsoft Corporation.
DIB (Microsoft Windows Device Independent Bitmap)
See the description of BMP. DIB is supported only under the OS/2 operating system.
EMF (Microsoft NT Enhanced Metafile)
Supported only under Windows 95, Windows 98, and Windows NT.
EPS
Encapsulated Postscript
EPSI (Microsoft NT Enhanced Metafile)
An extended version of the standard PostScript (PS) format. Files that use this format can be printed on PostScript printers and can also be imported into other applications. Notice that EPSI files can be read, but PS files cannot be read.
GIF (Graphics Interchange Format)
Supports only color-mapped images. GIF is owned by CompuServe, Inc.
JFIF (JPEG File Interchange Format)
Supports JPEG image compression. JFIF software is developed by the Independent JPEG Group.
JPEG or JPG (Joint Photographic Experts Group)
A file format that is used for storing noninteractive images.
PBM (Portable Bitmap Utilities)
Supports gray-scale, color, RGB, and bitmap files. The Portable Bitmap Utilities are a set of free utility programs that were developed primarily by Jef Poskanzer.
PCL
Printer Control Language
PDF (Portable Document Format)
A file format for electronic distribution and exchange of documents.
PNG (Portable Network Graphic)
Supports true color, gray-scale, and 8-bit images.
PS (PostScript Image File Format)
The Image classes use only PostScript image operators. A level II PS printer is required for color images. PostScript was developed by Adobe Systems, Inc.
PSL (PostScript)
Postscript
SASEMF (Enhanced Metafile)
An EMF image tuned for RTF output.
STATIC
Chooses the best image format for the current ODS destination.
SVG (Scalable Vector Graphics)
Is an XML language for describing two-dimensional vector graphics.
TIFF (Tagged Image File Format)
Internally supports a number of compression types and image types, including bitmapped, color-mapped, gray-scaled, and true color. TIFF was developed by Aldus Corporation and Microsoft Corporation and is used by a wide variety of applications (available if licensed).
WMF (Microsoft Windows Metafile)
Supported only under MicroSoft Windows operating systems.
XBM
X Window Bitmap
XPM
X Window Pixmap