ODS Graphics Template Modification

%GrTitle Macro Details

The %GrTitle macro does the following:

  • The macro deletes all modified templates in the Work library.

  • PROC TEMPLATE generates a list of each template that matches the specified path.

  • PROC TEMPLATE writes each graph template to a file.

  • DATA steps follow the links.

  • A DATA step modifies the template code and submits it to SAS using CALL EXECUTE.

You can use OPTIONS=DISPLAY to display the ENTRYTITLE and NOTES statements:

%grtitle(path=Stat.Logistic.Graphics.AnomPlot, options=display)

In the analysis-of-means plot, the original template has two ENTRYTITLE statements:

entrytitle _TITLE;
entrytitle textattrs=GRAPHVALUETEXT _CLSTR;

Both statements rely on dynamic variables that PROC LOGISTIC sets and sends to the template. The macro modifies the template by replacing those two statements with the following:

mvar Graphics_AnomPlot Graphics_AnomPlot2;
if (EXISTS(GRAPHICS_ANOMPLOT))
   entrytitle GRAPHICS_ANOMPLOT;
else
   entrytitle _TITLE;
endif;
if (EXISTS(GRAPHICS_ANOMPLOT2))
   entrytitle GRAPHICS_ANOMPLOT2;
else
   entrytitle textattrs=GRAPHVALUETEXT _CLSTR;
endif;

The titles can come from either the new macro variables or the old dynamic variables. If a macro variable exists, then ODS uses the title that you specified in that macro variable. If a macro variable has a null value (%LET Graphics_AnomPlot = ;), that title is suppressed. Otherwise, ODS uses the original title. There are no ampersands in the modified template. ODS substitutes the macro variable values at the time that PROC LOGISTIC runs, not at the time that the macro runs PROC TEMPLATE.

The following step modifies another PROC LOGISTIC template:

%grtitle(path=Stat.Logistic.Graphics.PhatPanel, options=display)

The macro produces the following messages in the SAS log:

   Stat.Logistic.Graphics.PhatPanel
      notes "Predicted Probability Plots";

      Logistic_PhatPanel
      entrytitle _TITLE;

The specified template is not a link, so one template name is displayed. The macro displays the NOTES statement, which provides information about the template’s purpose. You can specify the macro variable Logistic_PhatPanel to modify the title.

The original template comes from one of the item stores in your ODS path (by default, either Sasuser.Templat or Sashelp.Tmplmst). The modified template is saved in the item store Work.Templat. You can delete that item store as follows:

%grtitle(options=delete)

You can modify multiple templates at once. The following three steps modify all templates, all STAT templates, and all PROC LOGISTIC templates, respectively. Additional templates are modified when there are links. Common prefixes for additional templates include: Common, Stat.Bayes, Stat.Graphics, and Stat.Lmr.

%grtitle;
%grtitle(path=stat)
%grtitle(path=stat.logistic)

By default, each macro call begins by deleting all previously modified templates. The following steps modify both the PROC REG and the PROC GLM templates:

%grtitle(path=stat.reg)
%grtitle(path=stat.glm, options=nodelete)

The first step deletes all the templates in Work.Templat and then modifies the PROC REG templates. The second step additionally modifies PROC GLM templates but without deleting the previously modified templates that are in Work.Templat.

The following step lists all the modified templates that are in the Work library:

proc template;
   list / store=work.templat;
quit;

The results are displayed in Output 25.8.3. The macro modified templates from Common.Zreg, Stat.GLM, Stat.Graphics, and Stat.Reg.

Output 25.8.3: Modified Templates from PROC REG and PROC GLM

Listing of: WORK.TEMPLAT
Path Filter is: *
Sort by: PATH/ASCENDING
Obs Path Type
1 Common Dir
2 Common.Zreg Dir
3 Common.Zreg.Graphics Dir
4 Common.Zreg.Graphics.ConditionalFit Statgraph
5 Common.Zreg.Graphics.ContourFit Statgraph
6 Common.Zreg.Graphics.Fit Statgraph
7 Common.Zreg.Graphics.FitBoxPlot Statgraph
8 Common.Zreg.Graphics.IntPlot Statgraph
9 Common.Zreg.Graphics.NestPlot Statgraph
10 Common.Zreg.Graphics.Residual Statgraph
11 Common.Zreg.Graphics.ResidualPanel Statgraph
12 Common.Zreg.Graphics.SLICEFITPlot Statgraph
13 Stat Dir
14 Stat.GLM Dir
15 Stat.GLM.Graphics Dir
16 Stat.GLM.Graphics.BoxPlot Statgraph
17 Stat.GLM.Graphics.CooksD Statgraph
18 Stat.GLM.Graphics.FitSummary Statgraph
19 Stat.GLM.Graphics.LSMLinesPlot Statgraph
20 Stat.GLM.Graphics.MeanLinesPlot Statgraph
21 Stat.GLM.Graphics.MeansBoxPlot Statgraph
22 Stat.GLM.Graphics.ObservedByPredicted Statgraph
23 Stat.GLM.Graphics.Qq Statgraph
24 Stat.GLM.Graphics.RStudentByLeverage Statgraph
25 Stat.GLM.Graphics.RStudentByPredicted Statgraph
26 Stat.GLM.Graphics.ResidualByPredicted Statgraph
27 Stat.GLM.Graphics.ResidualHistogram Statgraph
28 Stat.GLM.Graphics.Rf Statgraph
29 Stat.Graphics Dir
30 Stat.Graphics.AnomPlot Statgraph
31 Stat.Graphics.DiffPlot Statgraph
32 Stat.Graphics.MeanPlot Statgraph
33 Stat.Reg Dir
34 Stat.Reg.Graphics Dir
35 Stat.Reg.Graphics.CooksD Statgraph
36 Stat.Reg.Graphics.CooksDChart Statgraph
37 Stat.Reg.Graphics.DFBETASPanel Statgraph
38 Stat.Reg.Graphics.DFBETASPlot Statgraph
39 Stat.Reg.Graphics.DFFITSPlot Statgraph
40 Stat.Reg.Graphics.DiagnosticsPanel Statgraph
41 Stat.Reg.Graphics.Fit Statgraph
42 Stat.Reg.Graphics.FitHeatMap Statgraph
43 Stat.Reg.Graphics.ObservedByPredicted Statgraph
44 Stat.Reg.Graphics.PartialPanel Statgraph
45 Stat.Reg.Graphics.PartialPlot Statgraph
46 Stat.Reg.Graphics.PredictionPanel Statgraph
47 Stat.Reg.Graphics.QQPlot Statgraph
48 Stat.Reg.Graphics.RFPlot Statgraph
49 Stat.Reg.Graphics.RStudentByPredicted Statgraph
50 Stat.Reg.Graphics.ResidualBoxPlot Statgraph
51 Stat.Reg.Graphics.ResidualByPredicted Statgraph
52 Stat.Reg.Graphics.ResidualHeatMap Statgraph
53 Stat.Reg.Graphics.ResidualHeatPanel Statgraph
54 Stat.Reg.Graphics.ResidualHistogram Statgraph
55 Stat.Reg.Graphics.ResidualPanel Statgraph
56 Stat.Reg.Graphics.ResidualPlot Statgraph
57 Stat.Reg.Graphics.RidgePanel Statgraph
58 Stat.Reg.Graphics.RidgePlot Statgraph
59 Stat.Reg.Graphics.SelectionCriterionPanel Statgraph
60 Stat.Reg.Graphics.SelectionCriterionPlot Statgraph
61 Stat.Reg.Graphics.StepSelectionCriterionPanel Statgraph
62 Stat.Reg.Graphics.StepSelectionCriterionPlot Statgraph
63 Stat.Reg.Graphics.StudResCooksDChart Statgraph
64 Stat.Reg.Graphics.StudentResChart Statgraph
65 Stat.Reg.Graphics.VIFPlot Statgraph
66 Stat.Reg.Graphics.rstudentByLeverage Statgraph


Last updated: December 09, 2022