Data visualization with SAS programming

Updating an ODS Graphics template, but the procedure is still using the old one.

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

Updating an ODS Graphics template, but the procedure is still using the old one.

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.


Accepted Solutions
Solution
‎02-02-2017 10:47 AM
SAS Super FREQ
Posts: 1,044

Re: Updating an ODS Graphics template, but the procedure is still using the old one.

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

 

https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_ods_sect006...

 

View solution in original post


All Replies
Solution
‎02-02-2017 10:47 AM
SAS Super FREQ
Posts: 1,044

Re: Updating an ODS Graphics template, but the procedure is still using the old one.

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

 

https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_ods_sect006...

 

Contributor
Posts: 25

Re: Updating an ODS Graphics template, but the procedure is still using the old one.

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.

 

SAS Super FREQ
Posts: 1,044

Re: Updating an ODS Graphics template, but the procedure is still using the old one.

You are most welcome. I appreciate your endorsement for the book.
Post a Question
Discussion Stats
  • 3 replies
  • 87 views
  • 1 like
  • 2 in conversation