BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, for this I'm producing RTF and using SAS 9.1.3.

If I use FRAME=HIDES and RULES=GROUPS in my style sheet, when I produce a table in PROC REPORT I get lines at the top and bottom of the table, along with a line between the header and the main body of the table - which is what I want.

I am using OPTIONS ORIENTATION=LANDSCAPE and PAPERSIZE=A4 to sort out the output file (is there another way?).

However, when my table span more than one page, I am having to force in page breaks (using BREAK AFTER in PROC REPORT) in order to get a line at the bottom of the table on each page. Is there any other way of doing this, because it's sometimes very awkward to calculate where page breaks are required. Surely there must be some way of informing ODS what page size to use and to insert the breaks itself (including the lines)?
3 REPLIES 3
wayne_sas
SAS Employee
I'm afraid there is not much that can be done. The table is too large for a page and when Word makes an implicit page break, the cell borders are not expressed because of the options you want to use.

We have hopes to address this at some point by having a way to determine when a page break is needed in the SAS code rather than send Word the entire table.

Orientation and papersize are the correct controls to use. The amount of text you can fit to a page is going also be impacted by the number or titles and footntoes as well as the size of the fonts used in the table. A smaller font allows more lines.
Cynthia_sas
SAS Super FREQ
Hi:
Here's my .02 with a program for you to experiment with. As the previous reply said, the only thing that SAS knows when it is handling the file is where the TABLE is going to end, NOT where the VIEWER will insert a page break. So, FRAME=HSIDES puts the line under the table and not at the end of each page.
 
You COULD put a line (using RTF control strings) into the first footnote ...and that would get you a line that goes at the bottom of each page, because ODS puts the footnote into the footer area of the document. You can see how this footnote looks with FRAME=HSIDES if you run this program (it uses sashelp.shoes) - a few of the REGIONS are too big to fit on 1 "page". After you run the program the first time, then change the FRAME=HSIDES to FRAME=ABOVE and submit the program again. This may give you something closer to what you want (lines under the column headers and a line for the footnote on each page. (Sadly, I do not know enough about RTF control strings to do more than pass on this very handy string that I got from somebody in Tech Support.)
 
The other pieces of ODS that go into making this work is the use of ODS ESCAPECHAR to specify an escape character so you can use the escapechar + S= in order to change PRETEXT= to pass the control string and then PROTECTSPECIALCHARS=off, which allows the string to pass from ODS to RTF unchanged.
cynthia
[pre]
options nodate nonumber;
title; footnote;
ods listing close;

title1 j=l font='Arial' h=10.1pt
"Protocol XXX"
j=r font='Arial' h=10.1pt
"^{pageof}";

title2 j=c font='Arial' h=10.1pt "Some Table";
title3 j=c font='Arial' h=10.1pt "Report Adverse Events";

**make sure there is a SPACE between the 1 and the quote;
** in the footnote below;
footnote j=l font='Arial' h=10.1pt
"^S={protectspecialchars=off "
"pretext='\brdrt\brdrs\brdrw1 '}"
"\~";
footnote2 j=l font='Arial' h=10.1pt
'Some Other Footnote Text';

ods listing close;
ods rtf file='c:\temp\line_vs_hsides.rtf' ;
ods escapechar='^';
proc report data=sashelp.shoes nowd
style(report)={rules=groups frame=hsides
cellspacing=0 borderwidth=1}
style(header)={background=white};
where region in ('Asia', 'Pacific','Canada');
column region subsidiary product sales;
define region /group;
define subsidiary/group;
define product /order;
define sales/sum;
break after region/ summarize page;
run;
ods rtf close;
title; footnote;
[/pre]
MattR
Calcite | Level 5

Thanks for this post! I was having a similar issue and this seems to be an acceptable fix for it.

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