BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Shawn08
Obsidian | Level 7

Hello,

 

I have a problem with the ods pdf extract of my proc report.

I included the compute before _page_ statement in order to put a title to my proc report. The problem I am encountering is that if my title fits on one line, the table will be printed fitting the page width. However, if my title is on 2 lines, then it separates my table in 2. An example can be seen in the following picture.

 

example.PNG

 

I only include the proc report part of my program as I think the problem is in this procedure and I excluded the style component of the procedure to only concentrate on how it prints.

 

proc report nowd data = table_&&a._dept&&i._&&l. style=[background = white outputwidth=100%] style(report)={outputwidth=100%};
			column (name &&t. &&u. &&v. &&w. &&x. &&y);
			define name / display "";
			define &&t. / display "&&n.";
			define &&u. / display "&&o.";
			define &&v. / display "&&p.";
			define &&w. / display "&&q.";
			define &&x. / display "&&r.";
			define &&y. / display "&&s.";
			compute before _page_ / style={fontfamily="times new roman" just=l fontsize=12pt background=white borderbottomcolor=white borderleftcolor=white borderrightcolor=white bordertopcolor=white color=black};
				line "&&k.";
			endcomp;
		run;

 

Thank you in advance for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
Hi:
Adobe has very strict page layout constraints. A SAS title never would be placed in the middle of a page. A SAS title always goes at the top of a page and any TITLE statements between procedures, when you have STARTPAGE=NO are ignored.

When you use ODS PDF, those "between table" captions cannot be written with a TITLE statement, as you discovered. They need to either be written with COMPUTE BEFORE _PAGE_ as you show or they need to be written using ODS TEXT statements. If you use ODS TEXT, then you have to either change the style template for CLASS USERTEXT, to make it justify and font the way you want or you have to use ODS ESCAPECHAR.

Cynthia

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
Without data to test and since you are using Macro variables for everything, it is nearly impossible to make any suggestions. For anyone to replicate your issue, they would have to completely re-create your data and your macro code.

If you cannot post ALL your code and some data here in the Forum, then your best resource might be SAS Tech Support, since they can look at all your code and all your data and keep it confidential.

The reason someone needs to see ALL your code is that with ODS PDF, settings like UNIFORM, Margins, PAPERSIZE all come into play.

One suggestion that I can think of is to try to specify a slightly smaller font size for the COMPUTE BEFORE _PAGE_ -- see what happens at 11pt or 10pt.

What you're writing is NOT a SAS title. It is mimicking a title, but you are writing a LINE with a PROC REPORT LINE statement. That means you need to make sure that what you write with the LINE statement has to fit within the boundaries of the table, border lines included -- NOT within the margins, like the title.

Cynthia
Shawn08
Obsidian | Level 7

You might be narrowing on the problem. I was attempting to write a title for my proc report. However, when I used the title "..."; statement right before the proc report, it was writing the title at the top of the page instead of above the table produced by proc report.

 

Would you know why, when creating a pdf file with ods pdf, the title statement before a proc report writes the title at the top of the page instead of right above the table?

 

Thank you

Cynthia_sas
SAS Super FREQ
Hi:
Adobe has very strict page layout constraints. A SAS title never would be placed in the middle of a page. A SAS title always goes at the top of a page and any TITLE statements between procedures, when you have STARTPAGE=NO are ignored.

When you use ODS PDF, those "between table" captions cannot be written with a TITLE statement, as you discovered. They need to either be written with COMPUTE BEFORE _PAGE_ as you show or they need to be written using ODS TEXT statements. If you use ODS TEXT, then you have to either change the style template for CLASS USERTEXT, to make it justify and font the way you want or you have to use ODS ESCAPECHAR.

Cynthia
ChrisNZ
Tourmaline | Level 20

It looks as if the break takes place because the entry in column 1 is too long for the table to fit, not because of the titles.

 

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