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

I'm using #BYVAL in a footnote statement in 9.4M3.  Looks like the footnote is reporting the value of the next by-group rather than the current by group.  It works as expected in the title statement.

 

proc sort data=sashelp.class out=class;
  by sex;
run;

options nobyline;

proc report data=class nowd;
  by sex;
  title1 "below is print out of: #BYVAL1";
  footnote1 "above is print out of: #BYVAL1";;
run;

byvalue.PNG

 

 

Looks like same issue as:

https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/SG-ODS-RTF-BODYTITLE-BYVAL-in-FOOTNOTE-sta...

 

I tried in 9.3 and get the same result. 

 

Does this mean that #BYVAL doesn't work well for footnotes? 

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

According to the documentation, the #BYVAL, #BYVAR etc. are only available for the TITLE statement, but not in the FOOTNOTE statement.

 

See here

TITLE, http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p10gcmrmf83iaxn1ilrx4pra969n.htm&docs...

FOOTNOTE, http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n0wh407rnaleinn1rqyudxuzhkhu.htm&docs...

 

So works as documented.

 

One can argue, that one should get some sort of warning when using the #BY... in a FOOTNOTE statement.

View solution in original post

7 REPLIES 7
Astounding
PROC Star

Just to add to the merriment, when I test your program (Unix/Linux), I'm getting a footnote that includes the characters "#BYVAL1" without the value of the variable.

BrunoMueller
SAS Super FREQ

According to the documentation, the #BYVAL, #BYVAR etc. are only available for the TITLE statement, but not in the FOOTNOTE statement.

 

See here

TITLE, http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p10gcmrmf83iaxn1ilrx4pra969n.htm&docs...

FOOTNOTE, http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n0wh407rnaleinn1rqyudxuzhkhu.htm&docs...

 

So works as documented.

 

One can argue, that one should get some sort of warning when using the #BY... in a FOOTNOTE statement.

Quentin
Super User

Thanks @BrunoMueller.  That's an unfortunate surprise.  I hadn't before thought about possible differences between TITLE statements and FOOTNOTE statements.

 

It interesting that in SAS/GRAPH, titles and footnotes are documented together http://support.sas.com/documentation/cdl/en/graphref/69717/HTML/default/viewer.htm#n19y35ila5aaysn1q..., and from the related thread https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/SG-ODS-RTF-BODYTITLE-BYVAL-in-FOOTNOTE-sta... it looks like using #BYVAL in  a SAS/GRAPH or SG plot footnote works, as long as you use GFOOTNOTE so that footnote is part of the graph.  Maybe I'll put in a idea submisssion to get #BYVAL working in SAS BASE footnotes.

 

I haven't used #BYVAL much.  But seems like often when I try, I end up backing away from it and resort to writing my own macro  looping.  Beause I ended up wanting to use that #BYVAL to somewhere like a footnote or a table of contents link, or a file name, or .... so &BYVAL becomes more flexible.  But if I were still in the role of making statistical reports for internal users that didn't have to be pretty, I'm sure I would use #BYVAL more often.

 

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
art297
Opal | Level 21

@Quentin: If you don't mind deleting two pages, the following will produce the desired result:

proc sort data=sashelp.class out=class;
  by sex;
run;

data class;
  set class;
  by sex;
  x=0;
  if last.sex then do;
    output;
    x=1;
    output;
  end;
  else output;
run;

options nobyline;

proc report data=class nowd;
  by sex x;
  title1 "below is print out of: #BYVAL1";
  footnote1 "above is print out of: #BYVAL1";
run;

Art, CEO, AnalystFinder.com

 

Quentin
Super User

Thanks @art297, but in my setting of storted process making web reports, it isn't feasible to delete the extra pages.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
BrunoMueller
SAS Super FREQ

If you need this information in the footnote statement, then I suggest you have a look at programming pattern described by @ChrisHemedinger, see his blog entries

 

http://blogs.sas.com/content/sasdummy/2012/03/20/sas-program-by-processing/

and

http://blogs.sas.com/content/sasdummy/2012/03/23/improving-on-a-sas-programming-pattern/

Quentin
Super User

Thanks again @BrunoMueller.  Yes, that's the sort of macro looping I generally use.  But I thought for this project I might be in a setting where I could use the BY statement and benefit from the efficiency, so wanted to give it a shot.  For now, I just moved by footnote to a subtitle to get it working.  I'm sure by the end it will be refactored into macro looping like Chris showed.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 7 replies
  • 1885 views
  • 1 like
  • 4 in conversation