BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
scan
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

3 REPLIES 3
Jay54
Meteorite | Level 14

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

 

scan
Obsidian | Level 7

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.

 

Jay54
Meteorite | Level 14
You are most welcome. I appreciate your endorsement for the book.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 827 views
  • 1 like
  • 2 in conversation