Hello,
I would appreciate help regarding the following. I am using proc report with ods pdf output in SAS 9.3. As part of the output, I would like to include a table with a variable number of rows. I am having difficulty getting the page breaks to occur at the correct locations with the correct formatting. For example, sometimes the last row is missing the bottom border.
Also, I am getting the following error: "Continuing contents of page NN, which would not fit on a single physical page."
I have spent a lot of time researching this error and have not been able to find a solution that applies to my situation. Therefore, I would like to see if there is a way to compute the number of lines in a table and then create page breaks after a certain number of lines. For example, below the number of lines is 9. Is there a way to compute this number?
Column 1 Column 2 Column 3
ABC blah blah test test
blah blah test test
blah test
DEF blah blah test test
blah blah test test
GHI blah blah test test
blah blah test test
blah blah test test
blah test
Thanks,
KelseyB
You might want to investigate adding a variable to your data that is used to create a page break either in a BY statement or .
Since the number of lines displayed per page is going to be influenced by title, footnote, fontsizes and paper or logical page size, numbers of summaries and such there really isn't a generic solution to "number of lines" per page issues.
I have had the luxury with some of my projects of allways knowing the numbers of subgroups and sub-subgroups and so could relatively easily add a page variable in a data step such as:
data addpage;
set data;
if column1 in ('ABC' 'DEF') then PageVar=1;
else if column1 in ('GHI') then PageVar=2;
run;
Assuming the generation of the report doesn't take too long then look at your result and add variable as makes sense.
You might want to investigate adding a variable to your data that is used to create a page break either in a BY statement or .
Since the number of lines displayed per page is going to be influenced by title, footnote, fontsizes and paper or logical page size, numbers of summaries and such there really isn't a generic solution to "number of lines" per page issues.
I have had the luxury with some of my projects of allways knowing the numbers of subgroups and sub-subgroups and so could relatively easily add a page variable in a data step such as:
data addpage;
set data;
if column1 in ('ABC' 'DEF') then PageVar=1;
else if column1 in ('GHI') then PageVar=2;
run;
Assuming the generation of the report doesn't take too long then look at your result and add variable as makes sense.
Thanks ballardw. I will try this suggestion!
So what do you want on each page. Is it 20 observations, then:
data report_data; set report_data; pge=floor(_n_/20); run; proc report ...; ... break on pge / page; ...
If its on a group then break on group. If its something else, please specify. Also note, you can export the data from proc report with an out=, which will have the data as in the report, you could use that, but the question is why, just fix the breaking yourself in a datastep.
RW9,
Thank you for your feedback. I need to break on the number of lines, not rows, in my dataset. Otherwise, I would use your logic. I think I will just count the number of characters and see if I can figure something out from there.
Thank you though.
What I have seen before, and done myself also, is to have a split variable macro, this takes a string and splits into known fixed widths, sometimes with indentations:
VAR1
abcdefghijklm...aabb...
becomes
VAR1
abcd...
aabb...
Then following on from that, you can use the _n_/number per page. Basically do the calculation in pre-datastep then report.
Great! I will try this out. Thanks again.
Maybe you could take a look this paper I wrote before.
http://support.sas.com/resources/papers/proceedings12/389-2012.pdf
Coild you please tell me what is 'page' in following line?
proc report ...;
...
break on pge / page;
...
PGE is a variable created in the datastep before to indicate where a page break should go. The syntax is:
break on <variable> / <options>;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.