The SAS Output Delivery System and reporting techniques

How to place footnote at bottom of each page ODS RTF

Reply
New Contributor
Posts: 4

How to place footnote at bottom of each page ODS RTF

For ODS RTF, by default the footnote will appear below end of contents, but I want to have them repeated at bottom of each page. Is there a way if ods rff options or in proc template? 

 

Related code: 

 

proc template;
define style tablertf;

parent=styles.rtf;

replace body from document /
leftmargin=1.0in
rightmargin=1.0in
topmargin=1.0in
bottommargin=1.0in
;
replace table from output /
frame = hsides
rules = groups
cellpadding = 1pt
;

replace fonts /
'TitleFont' = ("Times Roman",8pt)
'TitleFont2' = ("Times Roman",8pt)
'headingFont' = ("Times Roman",8pt)
'docFont' = ("Times Roman",8pt)
'footFont' = ("Times Roman",8pt)
;

replace color_list /
'fg' = black
'bg' = white
;

end;
run;

 

options orientation = portrait papersize = Letter NODATE NONUMBER NOBYLINE;
ods listing close;
ods rtf file = "C:\test.rtf" startpage=yes style=tablertf bodytitle_aux nogfootnote nogtitle notoc_data;
ods escapechar='^';

 

title1 font="Times New Roman" h=8pt j=c "This is my title";

footnote1 font="Times New Roman" h=8pt j=l "This is a footnote. ";
footnote2 font="Times New Roman" h=8pt j=l " ";
footnote3 font="Times New Roman" h=8pt j=l "Date: MMDDYYYY";

 

proc report; 

........

run; 

 

ods rtf close;

 

SAS Super FREQ
Posts: 8,646

Re: How to place footnote at bottom of each page ODS RTF

Hi:

Have you experimented without your new template and without the bodytitle_aux option? The default behavior of titles and footnotes is to appear on each page in the header/footer portion of the RTF document.
cynthia

 

Example created WITH bodytitle_aux:

with_bt_aux.png

 

On the other hand WITHOUT the bodytitle_aux option, the output appears as you describe -- with the TITLE and FOOTNOTE on each page:

without_bt_aux.png

New Contributor
Posts: 4

Re: How to place footnote at bottom of each page ODS RTF

Hi Cynthia, 

 

Thank you for the reply, however, I will still need the option of bodytitle_aux as I can use J=L J=R to adjust title and footnotes. In addition, I will need the title and footnote in the content area. 

 

I have tried the option for bodytitle, but the footnote is right below the contents too, not at bottom of each page. 

 

 

SAS Super FREQ
Posts: 8,646

Re: How to place footnote at bottom of each page ODS RTF

Hi:
BODYTITLE_AUX has a certain way of treating the title and footnote. As far as I know, there is no option to combine the "regular" behavior of titles and footnotes and also use either BODYTITLE or BODYTITLE_AUX.

You may have to post-process the RTF file using a Word macro or VB script using Microsoft tools to get what you want.

cynthia
New Contributor
Posts: 4

Re: How to place footnote at bottom of each page ODS RTF

Thanks for the reply. That was my guess too. 

 

I will keep looking for other alternative solutions. 

 

Valued Guide
Posts: 505

Re: How to place footnote at bottom of each page ODS RTF

Using  RTF options "bodytitle_aux nogfootnote nogtitle" with title and footnote on all pages

I know there will be a lot of pushback, but preprocessing data and running
a proc report for each page is vey flexible. It is like what adobe does with page
oriented PDFs. I don't think you will regret it in the long run.

I use Report as a dumb proc print. I never use across for instance.
Here is a very flexible brute force solution.

Maybe this is what you are tring to do

HAVE TWO PAGE RTF REPORT WITH TITILE ON 1ST PAGE AND FOOTNOTE ON LAST
=====================================================================

------------------------------------------------------------------

THIS IS MY TITLE ONLY ON PAGE 1


 MAKE   MODEL                             TYPE    ORIGIN  DRIVETRAI

 Acura  MDX                               SUV     Asia      All
 Acura  RSX Type S 2dr                    Sedan   Asia      Front
 Acura  TSX 4dr                           Sedan   Asia      Front
 Acura  TL 4dr                            Sedan   Asia      Front
 Acura  3.5 RL 4dr                        Sedan   Asia      Front
 Acura  3.5 RL w/Navigation 4dr           Sedan   Asia      Front
 Acura  NSX coupe 2dr manual S            Sports  Asia      Rear

---------------------------------------------------------------------

 MAKE   MODEL                             TYPE    ORIGIN  DRIVETRAI

 BMW      745Li 4dr                        Sedan  Europe   Rear
 BMW      M3 coupe 2dr                     Sports Europe   Rear
 BMW      M3 convertible 2dr               Sports Europe   Rear
 BMW      Z4 convertible 2.5i 2dr          Sports Europe   Rear
 BMW      Z4 convertible 3.0i 2dr          Sports Europe   Rear
 BMW      325xi Sport                      Wagon  Europe   All

THIS IS MY FOOTNOTE ONLY ON LAST PAGE
--------------------------------------------------------------------


WANT TITLE AND FOOTNOTE ON ALL PAGES
=====================================

---------------------------------------------------------------------

THIS IS MY TITLE ON ALL PAGES


 MAKE   MODEL                             TYPE    ORIGIN  DRIVETRAI

 Acura  MDX                               SUV     Asia      All
 Acura  RSX Type S 2dr                    Sedan   Asia      Front
 Acura  TSX 4dr                           Sedan   Asia      Front
 Acura  TL 4dr                            Sedan   Asia      Front
 Acura  3.5 RL 4dr                        Sedan   Asia      Front
 Acura  3.5 RL w/Navigation 4dr           Sedan   Asia      Front
 Acura  NSX coupe 2dr manual S            Sports  Asia      Rear


THIS IS MY FOOTNOTE ON ALL PAGES

--------------------------------------------------------------------

THIS IS MY TITLE ON ALL PAGES

 MAKE   MODEL                             TYPE    ORIGIN  DRIVETRAI

 BMW      745Li 4dr                        Sedan  Europe   Rear
 BMW      M3 coupe 2dr                     Sports Europe   Rear
 BMW      M3 convertible 2dr               Sports Europe   Rear
 BMW      Z4 convertible 2.5i 2dr          Sports Europe   Rear
 BMW      Z4 convertible 3.0i 2dr          Sports Europe   Rear
 BMW      325xi Sport                      Wagon  Europe   All

THIS IS MY FOOTNOTE ONLY ON LAST PAGE

--------------------------------------------------------------------

SOLUTION

* preprocess setting up pages - think PDF;
data cars;
  retain pge 0;
  set sashelp.cars(keep=
      make model type origin drivetrain msrp  invoice);
  by make notsorted;
  if first.make then pge=pge+1;
  if pge = 3 then stop;
  else output;
run;quit;

* using your settings;

proc template;
define style tablertf;
parent=styles.rtf;
replace body from document /
leftmargin=1.0in
rightmargin=1.0in
topmargin=1.0in
bottommargin=1.0in
;
replace table from output /
frame = hsides
rules = groups
cellpadding = 1pt
;

replace fonts /
'TitleFont' = ("Times Roman",8pt)
'TitleFont2' = ("Times Roman",8pt)
'headingFont' = ("Times Roman",8pt)
'docFont' = ("Times Roman",8pt)
'footFont' = ("Times Roman",8pt)
;
replace color_list /
'fg' = black
'bg' = white
;
end;
run;

options orientation = portrait papersize = Letter NODATE NONUMBER NOBYLINE;
ods listing close;
ods rtf file = "d:/rtf/test.rtf" style=tablertf bodytitle_aux nogfootnote nogtitle notoc_data startpage=yes;
ods escapechar='~';


%macro mny;
  %do pge=1 %to 2;
   ods rtf prepage="~S={outputwidth=100% just=l font_size=11pt font_face=arial just=c} {Table 1. Car Sales}";

   proc report data=cars(where=(pge=&pge)) nowd split='#' missing;

title1 font="Times New Roman" h=8pt j=c "This is my title";

footnote1 font="Times New Roman" h=8pt j=l "This is a footnote. ";
footnote2 font="Times New Roman" h=8pt j=l " ";
footnote3 font="Times New Roman" h=8pt j=l "Date: MMDDYYYY";

       cols make model type origin drivetrain msrp invoice;
       define make       / display  style={ just=l cellwidth=10% }  order=data;
       define model      / display  style={ just=l cellwidth=20% }  order=data;
       define type       / display  style={ just=l cellwidth=10% }  order=data;
       define origin     / display  style={ just=l cellwidth=20% }  order=data;
       define drivetrain / display  style={ just=l cellwidth= 8% }  order=data;
       define msrp       / display  style={ just=r cellwidth=15% }  order=data format=dollar12.;
       define invoice    / display  style={ just=r cellwidth=15% }  order=data format=dollar12.;
   run;quit;
   ods rtf text="~S={outputwidth=100% just=r font_size=9pt } {Page &pge of 2}";
   ods rtf text="~S={outputwidth=100% just=l font_size=8pt font_style=italic} {program: utl_report_by_age.sas }";
   ods rtf text="~S={outputwidth=100% just=l font_size=8pt font_style=italic} {output: utl_report_by_age.rtf}";
   run;
  %end;
%mend mny;
%mny;
ods rtf close;
ods listing;

New Contributor
Posts: 4

Re: How to place footnote at bottom of each page ODS RTF

This is a good example for my problem, I am trying to put the footnotes: such as page 1 of 2 etc. at bottom of each page, but current method is not working. We can see at each page, the footnote appear in different place right after the table, this is what I want to avoid. 

Attachment
Attachment
Valued Guide
Posts: 505

Re: How to place footnote at bottom of each page ODS RTF

Do you want Page n of m as the last line on each page right justified instead of attached to the report?

Page n of m will be in the bottom right corner last line.

Everything else the same?
Post a Question
Discussion Stats
  • 7 replies
  • 252 views
  • 0 likes
  • 3 in conversation