ODS Graphics Environment

The ODS GRAPHICS statement manages the settings of the ODS Graphics environment and is a statement that you will probably use frequently in your SAS sessions. For example, the ODS GRAPHICS statement provides options that control the physical aspects of your graphs, such as the image size and the name of the image file that is created for the graph.
The default image size of 640 pixels by 480 pixels (4:3 aspect ratio) for ODS Graphics is set in the SAS Registry. You can change the image size using the WIDTH= option, or the HEIGHT= option, or both in the ODS GRAPHICS statement. To name the output image file, use the IMAGENAME= option.
The following ODS GRAPHICS statement sets a 320 pixel width for the graph and names the output image file modelfit:
ods graphics / width=320px
               imagename="modelfit" reset;

proc sgrender data=sashelp.class template=modelfit;
run;

ods graphics off;
  • The WIDTH= option sets the image width to 320 pixels. Because no HEIGHT= option is used, SAS uses the design aspect ratio of the graph to compute the appropriate height. (The width of 320px is half the default width, so SAS sets the height to 240px, which is half the default height.)
  • The IMAGENAME= option sets the name of the output image file to modelfit. The RESET option ensures that each time the graph is produced, the previous version of the image file is replaced. Otherwise, image names are incremented (modelfit1, modelfit2, and so on) every time the graph is produced.
In general, it is good practice to specify only one sizing option without the other—just the WIDTH= option or just the HEIGHT= option. That way SAS can maintain the design aspect ratio of the graph, which might be important for many graphs. For example, a graph that has multiple columns or a statistics table on the side needs a wide aspect ratio. Specifying both width and height in such cases might produce unpredictable results.
Note: Size settings in the ODS GRAPHICS statement affect all of the graphs that are rendered in the SAS session, unless they are changed by another ODS GRAPHICS statement. The size for a graph produced by an individual template can be set with the DESIGNWIDTH= and DESIGNHEIGHT= options in the BEGINGRAPH statement. Size settings in the ODS GRAPHICS statement override size settings in the BEGINGRAPH statement and remain in effect unless they are changed on another ODS GRAPHICS statement or ODS GRAPHICS are turned off.
For more information about using the ODS GRAPHICS statement in GTL, see SAS Graph Template Language: User's Guide. For a more complete discussion of the ODS GRAPHICS statement, see SAS Output Delivery System: User's Guide.