ODS Graphics Template Modification

Example 22.5 Adding Text to Every Graph

(View the complete code for this example.)

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');
run;

The results for PROC REG are shown in Output 22.5.1.

Output 22.5.1: PROC REG Templates

Listing of: SASHELP.TMPLSTAT
Path Filter is: Stat.Reg
Sort by: PATH/ASCENDING
ObsPathType
1Stat.Reg.Graphics.CooksDStatgraph
2Stat.Reg.Graphics.CooksDChartStatgraph
3Stat.Reg.Graphics.DFBETASPanelStatgraph
4Stat.Reg.Graphics.DFBETASPlotStatgraph
5Stat.Reg.Graphics.DFFITSPlotStatgraph
6Stat.Reg.Graphics.DiagnosticsPanelStatgraph
7Stat.Reg.Graphics.FitStatgraph
8Stat.Reg.Graphics.FitHeatMapStatgraph
9Stat.Reg.Graphics.ObservedByPredictedStatgraph
10Stat.Reg.Graphics.PartialPanelStatgraph
11Stat.Reg.Graphics.PartialPlotStatgraph
12Stat.Reg.Graphics.PredictionPanelStatgraph
13Stat.Reg.Graphics.QQPlotStatgraph
14Stat.Reg.Graphics.RFPlotStatgraph
15Stat.Reg.Graphics.RStudentByPredictedStatgraph
16Stat.Reg.Graphics.ResidualBoxPlotStatgraph
17Stat.Reg.Graphics.ResidualByPredictedStatgraph
18Stat.Reg.Graphics.ResidualHeatMapStatgraph
19Stat.Reg.Graphics.ResidualHeatPanelStatgraph
20Stat.Reg.Graphics.ResidualHistogramStatgraph
21Stat.Reg.Graphics.ResidualPanelStatgraph
22Stat.Reg.Graphics.ResidualPlotStatgraph
23Stat.Reg.Graphics.RidgePanelStatgraph
24Stat.Reg.Graphics.RidgePlotStatgraph
25Stat.Reg.Graphics.SelectionCriterionPanelStatgraph
26Stat.Reg.Graphics.SelectionCriterionPlotStatgraph
27Stat.Reg.Graphics.StepSelectionCriterionPanelStatgraph
28Stat.Reg.Graphics.StepSelectionCriterionPlotStatgraph
29Stat.Reg.Graphics.StudResCooksDChartStatgraph
30Stat.Reg.Graphics.StudentResChartStatgraph
31Stat.Reg.Graphics.VIFPlotStatgraph
32Stat.Reg.Graphics.rstudentByLeverageStatgraph


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;
      . . .