Is there any way to make this work? The BYVAL in the footnote is for the next by group.
Edit: It turns out that it does not work with options "bodytitle nogtitle nogfootnote" the options I need to use.
Message was edited by: data _null_
I checked with the developers, and they say this is a problem that can't be fixed.
As a work-around, I would suggest using gplot with gtitles & gfootnotes ...
proc sort data=sashelp.class out=class;
by sex;
run;
ods rtf /*file="~/test.rtf"*/ bodytitle gtitle gfootnote;
proc gplot data=class;
by sex;
plot height*age;
title '#byval(sex)';
footnote '#byval(sex)';
run;
ods rtf close;
Not sure what version you are using but on my 9.3 install I don't even get the M or F in the footnote - byval is not actioned at all. I presume you don't want workarounds such as looping etc.?
I'm working on the workaround I was hoping for easy. :smileyshocked:
I checked with the developers, and they say this is a problem that can't be fixed.
As a work-around, I would suggest using gplot with gtitles & gfootnotes ...
proc sort data=sashelp.class out=class;
by sex;
run;
ods rtf /*file="~/test.rtf"*/ bodytitle gtitle gfootnote;
proc gplot data=class;
by sex;
plot height*age;
title '#byval(sex)';
footnote '#byval(sex)';
run;
ods rtf close;
Actually, you existing SGPLOT will work fine with GTITLE/GFOOTNOTE as well.
I can also reproduce the problem you're seeing with sgplot at 9.4.
You might need to use gplot (with gtitle & gfootnote) instead ...
proc sort data=sashelp.class out=class;
by sex;
run;
proc gplot;
by sex;
plot height*age;
title '#byval(sex)';
footnote '#byval(sex)';
run;
I only have 9.3 and even with GPLOT I still get the same bad result for RTF destination.
You can also try removing the BODYTITLE option from the ODS RTF statement, such as:
ods rtf file="~/test.rtf" nogtitle nogfootnote;
Another option is to use GTL with the Entrytitle and Entryfootnote statement.
proc sort data=sashelp.class out=class;
by sex;
run;
/*---------------------------------------------------------------------*/
/* Using Entrytitle and Entryfootnote */
/*---------------------------------------------------------------------*/
goptions reset = all;
proc template;
define statgraph newplot;
dynamic _byval_;
begingraph;
entrytitle _byval_;
entryfootnote _byval_;
layout overlay;
scatterplot x = age y = height;
endlayout;
endgraph;
end;
run;
ods rtf file="test3.rtf" nogtitle nogfootnote;
proc sgrender data = class template = newplot;
by sex;
run;
ods rtf close;
I am actually having the same problem with ODS HTML output from SGPLOT and i just stumbled on this thread. i am using NOGTITLE with #BYVAL and LINK to be able to jump from a chart to a tabular report of the same data. it worked great under 9.3 but the day we migrated to 9.4 (this is z/OS by the way) the #BYVAL started displaying the next by value rather than the current. if you run the same code with GFOOTNOTE the value is correct but the hyperlink does not work. I have submitted a tracks since this absolutely worked correctly under 9.3 and broke with 9.4 so I don't think the response above that "I checked with the developers, and they say this is a problem that can't be fixed" is correct.
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 25. 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.