# Statistical Graphics Using ODS

## Graph Size and Resolution

ODS provides options for specifying the size and resolution of graphs. You can specify the size of a graph in the ODS GRAPHICS statement and the resolution in an ODS destination statement. There are two other ways to change the size of a graph, but they are rarely needed. The three methods are as follows:

• Usually, you specify the WIDTH= or HEIGHT= option (or both) in the ODS GRAPHICS statement to change the size of a graph.

• You can modify the size of a particular graph by specifying the dimensions in the DESIGNHEIGHT= and DESIGNWIDTH= options in the BEGINGRAPH statement in the template. Some templates contain the specification DESIGNWIDTH=DEFAULTDESIGNHEIGHT, which sets the width of the graph to the default height, or DESIGNHEIGHT=DEFAULTDESIGNWIDTH, which sets the height of the graph to the default width.

• You can modify the size of all your ODS graphs by specifying the dimensions in the OUTPUTHEIGHT= and OUTPUTWIDTH= options in the style template.

The following examples show typical ways to change the size of your graphs:

ods graphics on / width=6in;
ods graphics on / height=4in;
ods graphics on / width=4.5in height=3.5in;


The dimensions of the graph can be specified in pixels (such as 200PX), inches (such as 3IN), or centimeters (such as 8CM). The default dimensions of ODS Graphics are 640 pixels wide and 480 pixels high, and these values determine the default aspect ratio. The actual size of the graph in inches depends on your printer or display device. For example, if the resolution of your printer is 100 dots per inch (DPI) and you want a graph that is 4 inches wide, you should set the width to 400 pixels.

If you specify only one dimension, the other dimension is determined by the default aspect ratio—that is, height = 0.75 width. For best results, you should create your graphs by using the exact size that is used to display the graphs in your paper or presentation. In other words, avoid generating graphs at one size and then expanding or shrinking them for inclusion in your document.

By default, fonts and symbol markers are automatically scaled along with the size of the graph. You can suppress this scaling by specifying the SCALE= option, as in the following example:

ods graphics on / scale=off;


The default resolution of graphs that are created in the HTML and LISTING destinations is 96 DPI, whereas the default for the RTF destination is 200 DPI. The 200 DPI value is recommended if you are copying and pasting graphs into a Microsoft PowerPoint presentation or a Microsoft Word document. Graphs in SAS/STAT documentation are usually generated at 300 DPI for display in PDF and 96 DPI for display in HTML.

You can change the resolution by using the IMAGE_DPI= option in any ODS destination statement, as in the following example:

ods html image_dpi=300;


An increase in resolution often improves the quality of the graphs, but it also greatly increases the size of the image file. Going from 96 DPI to 300 DPI increases the size of the image file by approximately a factor of . Even when you are using a higher resolution for most of your graphs, you should consider using a lower resolution for some, such as contour plots, that create large files even at a lower resolution.

If you increase the resolution, you might need to compensate by reducing the size of the graph, as in the following example:

ods graphics on / width=4.5in  height=3.5in;


Increasing resolution also increases the amount of memory that is needed for your program to run. You can increase the amount of memory available to ODS Graphics by specifying an option when you invoke SAS, as in the following example:

   -jreoptions '(-Xmx256m)'


You can modify the default amount of memory available to ODS Graphics by changing JREOPTIONS in your SAS configuration file to the settings –Xmxnnnm –Xmsnnnm, where nnn is the amount of memory in megabytes. An example is –Xmx256m –Xms256m. In either case, the exact syntax varies depending on your operating system, and the amount of memory that you can allocate varies from system to system. For more information, see the SAS Companion for your operating system.