The SAS Output Delivery System and reporting techniques

ODS PDF: Control of page breaks within a single line of output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

ODS PDF: Control of page breaks within a single line of output

Hi everybody, I've read various posts, notes and documentation but my issue seems not to have been discussed yet: In 9.2, I write a report (ods pdf) that consists of serveral consecutive proc tabulate and proc report. Using startpage=no (or startpage=never as I do not produce graphs) and startpage=now I succeed in controlling individual page breaks. But now: One proc report prints a SAS Dataset that consists of 1 obs and 1 attribute length=$32767. It contains free floating text. So far in 9.1.3, the output of that particular proc report was printed adjusting the previous proc-tabulate in a seamless flow. If the 'big text block' did not completely fit onto the current page, it flowed over to the next sheet, repeating the title on the new page. That was all fine. Now, in 9.2, SAS checks if the 'big text block' fits onto the current page. If not, SAS skips to the next page. (If the text is even larger than a single page it does then flow over to a new page, repeating the title. Good behaviour like in 9.1.3) (Just for comparison: In MS Word there is a tick-box in the table options that allows a line to break over a page rather than moving the whole line onto the new page leaving an empty space on the bottom of the previous sheet.) My question: Does anyone know of an option that can be set? In ODS RTF there is KEEPN/NOKEEPN that might help. But I'm looking for an option like that in ODS PDF. Your ideas are highly appreciated


Accepted Solutions
Solution
‎06-30-2011 12:59 PM
SAS Super FREQ
Posts: 8,868

ODS PDF: Control of page breaks within a single line of output

Hi:

  I no longer have SAS 9.1.3 available for testing a comparison between 9.1.3 and 9.2. If you opened a track with Tech Support, they could test your real code in both versions of SAS. I am confused about what you say in your code comment that:

"

/* This should print right adjusting the prior     */

/* proc print WITHOUT skipping to the next page.   */

"

 

Once the PROC PRINT output has been "placed" on the page, there is no further "adjustment" of PROC PRINT that takes place. The PROC REPORT is placed independent of the procedure that preceded it. PROC REPORT could be preceded by a PROC GLM or a PROC FREQ or a PROC REG -- but once those procedures are done, the only thing that SAS does is send the appropriate page eject command, or not, depending on the setting of the STARTPAGE= option. If for some reason, the "big" table is not started under the PROC PRINT, it is either because ODS does not think there is room to start the table or ODS thinks it needs to issue a page eject for some reason. If you are observing different behavior -with the EXACT same code, the EXACT same options- in 9.1.3 versus 9.2, the appropriate thing to do is open a track with Tech Support.

If there is something in 9.2 that produces different page breaking behavior under the same set of code and data circumstances, then that is the kind of difference that might need to be documented with a Tech Support note.

cynthia

View solution in original post


All Replies
Super User
Posts: 11,343

ODS PDF: Control of page breaks within a single line of output

If it is only one variable I'd be tempted to try pulling into a macro variable and using PDF TEXT instead of a PROC to display. If the Text doesn't change, or rarely, I'd be tempted to use straight PDF TEXT.

SAS Super FREQ
Posts: 8,868

ODS PDF: Control of page breaks within a single line of output

Hi:

  In the absence of seeing some data or code, it is hard for me to visualize what you're describing. KEEPN/NOKEEPN is unique to ODS RTF as an option -- it doesn't work for ODS PDF. In some instances, the UNIFORM option with PDF will cause uniform cell widths to be used from page to page and this might help your issue. I understand that your PROC REPORT has 1 obs and a very large character variable, but I am having a hard time with your description that something about the PROC REPORT is having some kind of impact or interaction with PROC TABULATE???

  If you are observing differences between program output in SAS 9.1.3 and SAS 9.2, you might with to open a track with Tech Support. There were some enhancements to PDF in SAS 9.2 that might have caused different behavior -- but that would be something for Tech Support to determine.

cynthia

Occasional Contributor
Posts: 11

Re: ODS PDF: Control of page breaks within a single line of output

Posted in reply to Cynthia_sas

Thank you very much for your ideas.

@ballardw: A very interesting approach, I might have to invest some time to make the PDF TEXT look nice but the approach is brilliant.

I would like to add code and output to my post (sorry for the bad layout of my first text, copy/paste/publish swallowed my CRLF) to give you a better idea of my problem.

The code is simplified (the proc report and proc tabulate I mentionned are replaced by simple proc print, but thus has no impact on the outcome).

I ran the code on SAS 9.2 and 9.1.3. You'll see the difference in the output. I still hope that I'll have to set an ods-option to make the it look the same.

(I have attached the text file containing a lot of words in case you would like to run the program at your site. Do not pay attention to the text itself. I have copied some newspaper articles from the web. So please do not publish the text. It is ment to be used only for data processing purpose. It's dangerous these days to get caught in copyright issues.)

SAS Code

filename bigtxt 'C:\Temp\BigText.txt' ;

data work.bigfield ;

   length field  $32767 ;

   infile bigtxt  truncover dsd lrecl=32767 ;

   input  field  $32767. ;

run;

filename bigtxt clear ;

data work.smallfield ;

   length field $20 ;

   label  field = 'Label Title of Small Content';

   field = 'Small Content' ;

run;

ods listing close ;

ods pdf style=barrettsblue

        file ="C:\Temp\BigText.pdf" ;

ods pdf startpage=no ;

/* This prints on top of the 1st page: */

proc print data=work.smallfield  label noobs ;

run;

/* This prints just next on the same page: */

proc print data=work.smallfield  label noobs ;

run;

/* This should print right adjusting the prior     */

/* proc print WITHOUT skipping to the next page.   */

/* There is lots of room left on the 1st page.     */

/* Because the whole text does not fit onto page 1 */

/* SAS starts a new page in Version 9.2      */

proc report data=work.bigfield

            style(report)={borderwidth=1 cellwidth=99.5%}

            style(column)={borderwidth=0}

            nocenter nowindows box;

   column field ;

   define field / display;

   label  field = 'Label Title of Big Content';

run;

/* This prints right beneath proc report */

/* on the same page:                     */

proc print data=work.smallfield  label noobs ;

run;

ods pdf close ;

ods listing ;

Solution
‎06-30-2011 12:59 PM
SAS Super FREQ
Posts: 8,868

ODS PDF: Control of page breaks within a single line of output

Hi:

  I no longer have SAS 9.1.3 available for testing a comparison between 9.1.3 and 9.2. If you opened a track with Tech Support, they could test your real code in both versions of SAS. I am confused about what you say in your code comment that:

"

/* This should print right adjusting the prior     */

/* proc print WITHOUT skipping to the next page.   */

"

 

Once the PROC PRINT output has been "placed" on the page, there is no further "adjustment" of PROC PRINT that takes place. The PROC REPORT is placed independent of the procedure that preceded it. PROC REPORT could be preceded by a PROC GLM or a PROC FREQ or a PROC REG -- but once those procedures are done, the only thing that SAS does is send the appropriate page eject command, or not, depending on the setting of the STARTPAGE= option. If for some reason, the "big" table is not started under the PROC PRINT, it is either because ODS does not think there is room to start the table or ODS thinks it needs to issue a page eject for some reason. If you are observing different behavior -with the EXACT same code, the EXACT same options- in 9.1.3 versus 9.2, the appropriate thing to do is open a track with Tech Support.

If there is something in 9.2 that produces different page breaking behavior under the same set of code and data circumstances, then that is the kind of difference that might need to be documented with a Tech Support note.

cynthia

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 2580 views
  • 6 likes
  • 3 in conversation