BookmarkSubscribeRSS Feed
Daniel
Obsidian | Level 7
Good morning,

Is there a way to combine the goodness of ODS TAGSETS.RTF, in that it allows us to use the SPANROWS option of PROC REPORT, while being able to put the SAS titles and foonotes in the header and footer sections of the document (like ODS RTF does)? Having the footnote in the body of the document, as opposed to the footer section, means that the footnote will be placed immediately after the table is cut or ends on each page. This will not be a problem for most pages except for the last one, where the remaining portion of the table will often not take up the same space as on previous pages. I know the perfect solution would be to use ODS PDF which takes care of both of these issues, but that is not an option for us.

I'm not sure if this would be feasible, but I was thinking of passing raw RTF specification for a footer through SAS. However, I don't know if that would work and if so, where it should be placed (my knowledge of RTF is somewhat limited).

The end result I'm trying to accomplish in RTF would look like what the following code, taken from

http://www.sascommunity.org/wiki/Tips:Using_SPANROWS_To_Repeat_Values_Across_Pages

and created by Art Carpenter, produces (with slight modification to add title and footnote statements:

data class30;
set sashelp.class;
do check = 1 to 30;
output;
end;
run;
ods pdf file ='class30.pdf';
title "Title goes here";
footnote "Footnote goes here";
proc report data=class30 nowd out=show spanrows;
column age name check sex;
define age /order;
define name / order ;
run;
ods pdf close;

Thank you in advance for your help,

Daniel
3 REPLIES 3
wayne_sas
SAS Employee
Well, yes, but I'm not sure it will give you what you want until 9.3.

There is a tags sent as an example called rtf_sample that puts the titles and footers into the rtf header/footer areas of the doc. Unfortunately, it's action is like the trad rtf and the column headers are not re-initialized on page breaks, like the trad rtf that does not know where page breaks occur.

"Tagsets.rtf_sample" was never tested enough to be production, so that is another caveat. In 9.3, it was improved so that it will give you the kind of output it sounds like you want.

Also, with some complex "proc report with spanrows", I believe you will get better results using the "uniform" option on the "ods tagsets.rtf" statement.
Peter_C
Rhodochrosite | Level 12
> production, so that is another caveat. In 9.3, it was
> improved so that it will give you the kind of output


this is impressive
referring to 9.3 in "past tense" !
Duong
Obsidian | Level 7
Hi Daniel

I've not much experience with the RTF tagset but here is a modified of your example
to get what you are after(I believe) via ODS RTF. That is to use a by page variable.


data class30;
set sashelp.class;
do check = 1 to 30;
output;
end;
run;

data class30;
set class30;
pg = ceil(_n_/20);
run;

option nobyline;
ods rtf file ='c:\class30.rtf' bodytitle;

title1 j=c "Spanrows";
foonote1 j=l "Note: title and footnote are in the table body and not header/footer section";
proc report data=class30 nowd out=show spanrows;
column age name check sex;
by pg;
define age / order order=data;
define name / order order=data;
run;
ods rtf close;


Regards
Duong
www.tranz.co.uk

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1975 views
  • 0 likes
  • 4 in conversation