BookmarkSubscribeRSS Feed
aravind
Fluorite | Level 6
Hi

How can we print conditional footnotes in proc report in ODS PDF destination.

Right now I am using line statement to print the "End of Report" in the last page but it doesn't print on the bottom line instead it prints next to the last row in the report.

Help will be appreciated.

Thanks & Regards
SAM
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
SAS TITLE and FOOTNOTE statements are global statements that are not tied to a particular report location (such as only the first page or only the last page) or to a particular procedure. So, SAS TITLE and FOOTNOTE statements work the same way with PROC REPORT as they do with PROC MEANS, PROC GLM, PROC REG, PROC TABULATE, etc, etc. The place where you have an opportunity to alter report code is between procedure steps or between program steps. You cannot alter a SAS TITLE or FOOTNOTE while a procedure (such as PROC REPORT) is active.

And, if you use the PROC REPORT LINE statement, the output written by the LINE statement goes within the table boundary -- so at the top of the report, the LINE statement would be physically close to the top of the report table and at the end of the report, the LINE statement would be physically close to the bottom of the table -- which as you note, is probably NOT the same location as the bottom of the physical page.

Two options are possible:
1) use ODS TEXT= at the end of the PROC REPORT step to write a text string ONLY at the end of the report. If you would insert ODS ESCAPECHAR {NEWLINE} functions into the text string, you could position your text closer to the bottom of the page but if you have any footnote text at all, the ODS TEXT string would be above that footnote.
OR
2) use ODS DOCUMENT to save the output into a DOCUMENT store and then use ODS DOCUMENT commands to delete, alter or insert OBANOTE text.

There have been many previous forum postings on ODS TEXT and on ODS ESCAPECHAR -- depending on your version of SAS you may have to use
[pre]
ODS PDF TEXT= (SAS 9.1.3)
or
ODS TEXT= (SAS 9.2)
[/pre]

For an example of ODS DOCUMENT, look at this paper
http://support.sas.com/resources/papers/sgf09/318-2009.pdf
and specifically at the example on page 21 with OBBNOTE and how it adds different second title for each page of output (a different "before note" for Canada versus Germany.

cynthia
aravind
Fluorite | Level 6
Hi Cynthia,

I appreciate your time.
Well, I did use the ODS PDF TEXT ="*******END OF REPORT**********" but still its not printing on the bottom of the page.
I am using SAS EG4.2.
In the Proc Report procedure i am creating a report into PDF File. I have a page break variable and it prints 5 pages report since there r 5 different values for the page break variable.

The way i am printing the END OF REPORT is find out the last page and inserting line statement in the compute block but it prints immediately down the last record in the report.

And as you suggested, I've used the ODS PDF TEXT and this one also does the same.
But i would prefer it to display on the bottom of the page.
I tried to use the ods newline function but you can only insert blank lines between a text string which is something like
***************END OF


REPORT********************
But not like leave few lines blank and print on the third line.

Thanks & Regards
SAM
Cynthia_sas
SAS Super FREQ
Hi:
As I said, using ODS PDF TEXT= will NOT guarantee that the text string appears close to the bottom of the page -- you may have to experiment with a LOT of ESCAPECHAR newline commands to move the text string down -- close to -- but not exactly in the same location as the footnote.

For example, in the code below, I start my text string with a style override that centers the text string and alters the font size and the font weight. Then I pass a non-breaking space (ESCAPECHAR+underscore char or ^_) with a command for 16 line feeds (ESCAPECHAR+16n) -- I used the 9.1.3 syntax because I wasn't sure which version of SAS you had. Note that my ESCAPECHAR is set to ^ so the ^_ is the non-breaking space and the ^S={...} is the style override and the ^16n is the 16 line feeds. In my output, I have explicitly put a FOOTNOTE statement so you can see how far away 16 line feeds is from the bottom of the table -- still not to the bottom of the physical page. And remember, since I could change the bottom margin, it is better to underestimate the number of line feeds instead of overestimating.

cynthia
[pre]
ods pdf file='c:\temp\bottom_text.pdf';
ods escapechar='^';

proc report data=sashelp.shoes nowd;
where product in('Boot','Sandal');
title 'The SAS Title';
footnote 'The SAS Footnote';
column product region sales inventory;
define product / group;
define region / group;
define sales / sum;
define inventory /sum;
break after product / summarize page;
run;

** you have to be careful with the number you use;
** ^_ is a non-breaking space;
** ^n is a single line feed and ^16n is 16 line feeds;
ods pdf text='^S={just=c font_weight=bold font_size=18pt}^_^16nEnd of Report';
ods pdf close;
[/pre]
aravind
Fluorite | Level 6
thanks a lot for the explanation of escapechar line functions.

aravind

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 1668 views
  • 0 likes
  • 2 in conversation