ODS Graphics Template Modification

Example 22.5 Adding Text to Every Graph

This example shows how to add text to one or more graphs. For example, you can create a macro variable, with project and date information, as follows:

%let date = Project 17.104, &sysdate;

In order to add this information to a set of graphs, you need to first know the names of their templates. You can list the names of every graph template for SAS/STAT procedures or for a particular procedure as follows:

proc template;
   list stat     / where=(type='Statgraph');
   list stat.reg / where=(type='Statgraph');

The results for PROC REG are shown in Output 22.5.1.

Output 22.5.1: PROC REG Templates

Path Filter is: Stat.Reg
Obs Path Type
1 Stat.Reg.Graphics.CooksD Statgraph
2 Stat.Reg.Graphics.CooksDChart Statgraph
3 Stat.Reg.Graphics.DFBETASPanel Statgraph
4 Stat.Reg.Graphics.DFBETASPlot Statgraph
5 Stat.Reg.Graphics.DFFITSPlot Statgraph
6 Stat.Reg.Graphics.DiagnosticsPanel Statgraph
7 Stat.Reg.Graphics.Fit Statgraph
8 Stat.Reg.Graphics.FitHeatMap Statgraph
9 Stat.Reg.Graphics.ObservedByPredicted Statgraph
10 Stat.Reg.Graphics.PartialPanel Statgraph
11 Stat.Reg.Graphics.PartialPlot Statgraph
12 Stat.Reg.Graphics.PredictionPanel Statgraph
13 Stat.Reg.Graphics.QQPlot Statgraph
14 Stat.Reg.Graphics.RFPlot Statgraph
15 Stat.Reg.Graphics.RStudentByPredicted Statgraph
16 Stat.Reg.Graphics.ResidualBoxPlot Statgraph
17 Stat.Reg.Graphics.ResidualByPredicted Statgraph
18 Stat.Reg.Graphics.ResidualHeatMap Statgraph
19 Stat.Reg.Graphics.ResidualHeatPanel Statgraph
20 Stat.Reg.Graphics.ResidualHistogram Statgraph
21 Stat.Reg.Graphics.ResidualPanel Statgraph
22 Stat.Reg.Graphics.ResidualPlot Statgraph
23 Stat.Reg.Graphics.RidgePanel Statgraph
24 Stat.Reg.Graphics.RidgePlot Statgraph
25 Stat.Reg.Graphics.SelectionCriterionPanel Statgraph
26 Stat.Reg.Graphics.SelectionCriterionPlot Statgraph
27 Stat.Reg.Graphics.StepSelectionCriterionPanel Statgraph
28 Stat.Reg.Graphics.StepSelectionCriterionPlot Statgraph
29 Stat.Reg.Graphics.StudResCooksDChart Statgraph
30 Stat.Reg.Graphics.StudentResChart Statgraph
31 Stat.Reg.Graphics.VIFPlot Statgraph
32 Stat.Reg.Graphics.rstudentByLeverage Statgraph

You can show the source for the graph templates for SAS/STAT procedures or for a particular procedure as follows:

options ls=96;
proc template;
   source stat     / where=(type='Statgraph');
   source stat.reg / where=(type='Statgraph');
options ls=80;

The results of this step are not shown. However, Example 22.3 shows a portion of the template for the PROC REG diagnostics panel. Here, the OPTIONS statement is used to set a line size of 96, which sometimes works better than the smaller default line size when showing the source for large and complicated templates.

An abridged version of the first few lines of the diagnostics panel template is displayed next:

define statgraph Stat.Reg.Graphics.DiagnosticsPanel;
   notes "Diagnostics Panel";
   dynamic . . .;
   BeginGraph / designheight=defaultDesignWidth;
      entrytitle halign=left textattrs=GRAPHVALUETEXT _MODELLABEL
         halign=center textattrs=GRAPHTITLETEXT "Fit Diagnostics"
         " for " _DEPNAME;
      . . .