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

The results for PROC REG are shown in Output 22.6.1.

Output 22.6.1 PROC REG Templates
Listing of: SASHELP.TMPLMST
Path Filter is: Stat.Reg
Sort by: PATH/ASCENDING
Obs Path Type
1 Stat.Reg.Graphics.CooksD Statgraph
2 Stat.Reg.Graphics.DFBETASPanel Statgraph
3 Stat.Reg.Graphics.DFBETASPlot Statgraph
4 Stat.Reg.Graphics.DFFITSPlot Statgraph
5 Stat.Reg.Graphics.DiagnosticsPanel Statgraph
6 Stat.Reg.Graphics.Fit Statgraph
7 Stat.Reg.Graphics.ObservedByPredicted Statgraph
8 Stat.Reg.Graphics.PartialPanel Statgraph
9 Stat.Reg.Graphics.PartialPlot Statgraph
10 Stat.Reg.Graphics.PredictionPanel Statgraph
11 Stat.Reg.Graphics.QQPlot Statgraph
12 Stat.Reg.Graphics.RFPlot Statgraph
13 Stat.Reg.Graphics.RStudentByPredicted Statgraph
14 Stat.Reg.Graphics.ResidualBoxPlot Statgraph
15 Stat.Reg.Graphics.ResidualByPredicted Statgraph
16 Stat.Reg.Graphics.ResidualHistogram Statgraph
17 Stat.Reg.Graphics.ResidualPanel Statgraph
18 Stat.Reg.Graphics.ResidualPlot Statgraph
19 Stat.Reg.Graphics.RidgePanel Statgraph
20 Stat.Reg.Graphics.RidgePlot Statgraph
21 Stat.Reg.Graphics.SelectionCriterionPanel Statgraph
22 Stat.Reg.Graphics.SelectionCriterionPlot Statgraph
23 Stat.Reg.Graphics.StepSelectionCriterionPanel Statgraph
24 Stat.Reg.Graphics.StepSelectionCriterionPlot Statgraph
25 Stat.Reg.Graphics.VIFPlot Statgraph
26 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.4 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;
      . . .