BookmarkSubscribeRSS Feed
leonkd
Calcite | Level 5

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;

 

7 REPLIES 7
Cynthia_sas
SAS Super FREQ

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

leonkd
Calcite | Level 5

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. 

 

 

Cynthia_sas
SAS Super FREQ
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
leonkd
Calcite | Level 5

Thanks for the reply. That was my guess too. 

 

I will keep looking for other alternative solutions. 

 

rogerjdeangelis
Barite | Level 11
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;

leonkd
Calcite | Level 5

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. 


20161227151024.png20161227151052.png
rogerjdeangelis
Barite | Level 11
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?

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
  • 5154 views
  • 0 likes
  • 3 in conversation