With ODS Graphics, statistical procedures can automatically produce graphs as well as tables. Graphs are integrated with tables in the ODS output. ODS Graphics is available in procedures in SAS/STAT^{®}, Base SAS^{®}, SAS/ETS^{®}, SAS/QC^{®}, and other SAS^{®} products and is automatically provided with Base SAS software. Sometimes you might want to make changes to a graph which cannot be done using options provided by the procedure. There are three general approaches to making changes to ODS graphs. The methods vary in ease of use, interactivity, and permanence of changes.

**1. Use the SAS**^{®}** ODS Graphics Editor**

Beginning in SAS 9.3, the easiest way to make a one-time change to a single ODS graph that is not possible using existing options or suboptions in the procedure is to use the ODS Graphics Editor. The ODS Graphics Editor can be used to make changes to the elements of ODS graphs, such as line types, colors, plotting symbols, and adding annotation. These changes are shown as you make them. None of these modifications is permanently stored, and thus they do not affect future graphs.

To make graphs available for editing, include the SGE=ON option in an ODS HTML or ODS LISTING statement as shown below. Then run the procedure and double-click the icon of the editable graph in the Results window to open the graph in the Editor. Or right-click the graph icon and select Open as shown below.

The graph opens in the ODS Graphics Editor. For information on using the Editor, see "ODS Graphics Editor" in the "Statistical Graphics Using ODS" chapter of the *SAS/STAT User's Guide* or see the *SAS ODS Graphics Editor: User's Guide* for your release of SAS.

**2. Save the ODS graph data and use PROC SGPLOT to redraw the graph**

Often, the easiest and most versatile way to modify an ODS graph is to save the data that produces the graph and then recreate the graph as you want it using PROC SGPLOT. Once done, you can retain the code you develop and use it to make the same or similar modifications in future graphs if desired.

To save the graph data, specify the name of the graph in an ODS OUTPUT statement. Graph names can be found in "ODS Graphics" in the Details section of the documentation for the procedure that produces the ODS graph. Or simply right-click in the Results window on the plot's icon (as shown above) and select Properties. You can then use the capabilities of PROC SGPLOT to present the graph as you like. Several examples are presented in the notes listed below. For more information, see the documentation for PROC SGPLOT in the *SAS ODS Graphics: Procedures Guide*.

**Examples:**

- Modify the ROC plot produced by PROC LOGISTIC
- Modify the mean-mean scatter plot (DiffPlot) from the LSMEANS statement to show only significant differences
- Modify the EFFECTPLOT showing the fitted model
- Single graph with overlaid ROC curves for training and validation data

**3. Modify the ODS graph template**

To make changes affecting the appearance of an ODS graph in future runs of the procedure, you need to modify the ODS template that governs the graph. Graph template definitions are written in the Graph Template Language (GTL) in the TEMPLATE procedure. While developing custom graphs is beyond the scope of services that are provided by SAS Technical Support, Kuhfeld (2009) provides a macro that simplifies many template changes. Also see "ODS Graphics Template Modification" in the "Statistical Graphics Using ODS" chapter of the *SAS/STAT User's Guide* for your release of SAS. The books by Matange and Heath (2011) and by Matange (2013) are also particularly useful. There are a number of SAS^{®} Global Forum papers that discuss customizing templates for ODS Graphics. Several papers on this topic are listed below. You can search the SGF proceedings at the SAS Global Forum website.

__________

**Resources and References**

Gallery of PROC SGPLOT example plots

Cartier, J. 2006. "A Programmer's Introduction to the Graphics Template Language." *Proceedings of the Thirty-first Annual SAS Users Group International Conference.* Paper 262-31. Cary, NC: SAS Institute Inc.

Kuhfeld, W.F. 2009. "Modifying ODS Statistical Graphics Templates in SAS 9.2." *Proceedings of the 2015 SAS Global Forum.* Paper 323-2009. Cary, NC: SAS Institute Inc.

Matange, S. 2013. *Getting Started with the Graph Template Language in SAS: Examples, Tips, and Techniques for Creating Custom Graphs*. Cary, NC: SAS Institute Inc.

Matange, S. and Heath, D. 2011. *Statistical Graphics Procedures by Example: Effective Graphs Using SAS*. Cary, NC: SAS Institute Inc.

Rodriguez, R. N. and T. E. Balan. 2006. "Creating Statistical Graphics in SAS 9.2: What Every Statistical User Should Know." *Proceedings of the Thirty-first Annual SAS Users Group International Conference.* Paper 192-31. Cary, NC: SAS Institute Inc.

Yeh, S. 2005. "Customizing ODS Statistical Graphics." *Proceedings of the Thirtieth Annual SAS Users Group International Conference.* Paper 183-30. Cary, NC: SAS Institute Inc.

Zender, C. and C. Truxillo. 2005. "Customizing ODS Statistical Graphs." *Proceedings of the Thirtieth Annual SAS Users Group International Conference.* Paper 239-30. Cary, NC: SAS Institute Inc.

Additional ODS graphics references

Product Family | Product | System | SAS Release | |

Reported | Fixed* | |||

SAS System | SAS/STAT | All | n/a | |

SAS System | SAS/QC | All | n/a | |

SAS System | SAS/OR | All | n/a | |

SAS System | SAS/ETS | All | n/a |

Type: | Usage Note |

Priority: | low |

Topic: | Query and Reporting ==> Creating Reports ==> Graphical SAS Reference ==> ODS (Output Delivery System) Common Programming Tasks Analytics ==> Statistical Graphics |

Date Modified: | 2020-03-10 14:10:40 |

Date Created: | 2006-09-06 13:25:54 |