Dear All,
I'm following some guidelines to update the title of a standard plot coming from an ODS graphics procedure inside the proc univariate.
basically I'm taking the template saved as "base.univariate.Graphics.Plots" with the procedure
proc template;
source base.univariate.Graphics.Plots / file='C:\Myfile.txt';
run;
then I'm copy-pasting it into a sas program, changing the second default title to the title that I need:
proc template;
define statgraph base.univariate.Graphics.Plots;
dynamic _VARNAME _VARLABEL _REFINT _REFSLOPE _WEIGHTED _TITLE1_NONE _GRAPH_TITLE1 _TITLE1_VARLABEL _GRAPH_TITLE2 _GRAPH_FOOTNOTE1 _GRAPH_FOOTNOTE2 _byline_ _bytitle_ _byfootnote_;
BeginGraph ;
if (_WEIGHTED)
if (NOT EXISTS(_TITLE1_NONE))
if (EXISTS(_GRAPH_TITLE1))
EntryTitle _GRAPH_TITLE1;
else
if (_TITLE1_VARLABEL)
EntryTitle "Weighted Distribution and Probability Plot for " _VARLABEL;
else
EntryTitle "Weighted Distribution and Probability Plot for " _VARNAME;
endif;
endif;
endif;
if (EXISTS(_GRAPH_TITLE2))
EntryTitle _GRAPH_TITLE2;
endif;
else
if (NOT EXISTS(_TITLE1_NONE))
if (EXISTS(_GRAPH_TITLE1))
EntryTitle _GRAPH_TITLE1;
else
if (_TITLE1_VARLABEL)
EntryTitle "Treatment: &TRT. ";
else
EntryTitle "Treatment: &TRT.";
endif;
endif;
endif;
if (EXISTS(_GRAPH_TITLE2))
EntryTitle _GRAPH_TITLE2;
endif;
endif;
Layout Gridded / rows=2 rowgutter=1.0pct;
Layout Lattice / columns=2 columnweights=(0.8 0.2) columngutter=0.5pct rowdatarange=union;
RowAxes;
RowAxis / label=_VARLABEL;
EndRowAxes;
HistogramParm x=BINX y=BINCOUNT / orient=horizontal;
BoxplotParm stat=STAT y=VALUE / outliertip=(Y);
EndLayout;
Layout Overlay / xaxisopts=(label="Normal Quantiles" linearopts=(thresholdmin=1 thresholdmax=1)) yaxisopts=(label=_VARLABEL);
ScatterPlot x=QUANTILE y=DATA;
LineParm x=0 y=_REFINT slope=_REFSLOPE / clip=TRUE extend=TRUE lineattrs=GRAPHFIT;
EndLayout;
EndLayout;
if (EXISTS(_GRAPH_FOOTNOTE1))
EntryFootnote _GRAPH_FOOTNOTE1;
endif;
if (EXISTS(_GRAPH_FOOTNOTE2))
EntryFootnote _GRAPH_FOOTNOTE2;
endif;
if (_BYTITLE_)
entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
else
if (_BYFOOTNOTE_)
entryfootnote halign=left _BYLINE_;
endif;
endif;
EndGraph;
end;
run;
I've just modified the second kind of layout title with the following:
if (_TITLE1_VARLABEL)
EntryTitle "Treatment: &TRT. ";
else
EntryTitle "Treatment: &TRT.";
The SAS log says:
NOTE: STATGRAPH 'Base.Univariate.Graphics.Plots' has been saved to: SASUSER.TEMPLATE
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
As it is expected to do (according to the guidelines).
But when I'm launching my procedure:
ods graphics / reset=index imagefmt=png imagename="MyImage" width=10cm height=10cm;
proc univariate data=MyDataset plot;
var MyVar;
run;
SAS is still retrieving the standard output, instead of first trying to read the custom one.
Can someone please help me, and explain what is happening?
I'm afraid is some sort of catalog issue but can't find a proper solution.
Thanks.
Check the ODS PATH settings. It should include SASUSER.TEMPLAT and SASHELP.TMPLMST.
Youcan set it. using:
ODS PATH SASUSER.TEMPLAT(update) SASHELP.TMPLMST(read) ;
Check the ODS PATH settings. It should include SASUSER.TEMPLAT and SASHELP.TMPLMST.
Youcan set it. using:
ODS PATH SASUSER.TEMPLAT(update) SASHELP.TMPLMST(read) ;
Dear Sanjay,
I do really like your book and your presentation at the PhUSE conference was great.
Now, thanks for the answer. I struggled on this for an entire day and now you solved it with a statement. Thank you.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.