BookmarkSubscribeRSS Feed
nirali514
Obsidian | Level 7

Is there a way to page break between 2 ods text lines with out using a space line?

 

ods text = The school has 300 students.

 

PAGE BREAK

 

ods text = A new study shows..

5 REPLIES 5
ballardw
Super User

Which ODS destination are you sending the output to?

HTML doesn't actually quite do "pages", XML or spreadsheets it is more "sheet" than page.

 

If you are sending the output to ODS RTF (or tagsets.rtf) or PDF you can use the ODS Escapechar coupled with the style element RAW to send the appropriate RTF or PDF code to insert a page break where desired.

If you only want a couple of blank lines then escapechar and the NEWLINE function allows specifying a number of new lines, Newline 3 would create two blank lines.

 

You may also want to investigate the procedure ODSTEXT where the P statement creates a paragraph of text and one or more P statements with no text creates blank lines.

nirali514
Obsidian | Level 7

I am using rtf.

 

Do you have an example of using ODS Escapechar coupled with the style element RAWbetween two ods text lines?

 

Thank you!

Reeza
Super User

I was hoping PageBREAK in PROC ODSTEXT would accomplish this, but no go. I think one of the main issues is you need an intermediary proc between them to make sure things work well. 

 

This also doesn't work as I would have expected 😞

ods rtf file='C:\_localdata\temp\output2.rtf' style=meadow startpage=no ;;

proc odstext pagebreak=on;
   p 'You can use the ODSTEXT procedure to add paragraphs
      and lists to your output.';
   p 'You can also format your text.' / style=[color=red fontsize=25pt];
   p 'This slide shows output created by PROC GMAP.' 
                                     / style=[color=purple fontsize=30pt];
run;




proc odstext;
   p 'You can use the ODSTEXT2 procedure to add paragraphs
      and lists to your output.';

run;


ods rtf close;
ballardw
Super User

@nirali514 wrote:

I am using rtf.

 

Do you have an example of using ODS Escapechar coupled with the style element RAWbetween two ods text lines?

 

Thank you!


This approach will not work with ODS RTF as the text is placed into tables and apparently the function will not successfully place a page break in the middle of a table. However ODS Tagsets.Rtf allows options to not set ODS text into a table. Also note that each of the ODS Text has the destination: ODS tagsets.RTF. Otherwise the "generic" ODS Text handler seems to ignore the rtf specific raw function.

 

ods escapechar='^' ;

ods tagsets.rtf file='d:\junk.rtf'
 options(Tables_OFF='USERTEXT');

ods tagsets.rtf text='example of forced page break in rtf ^{raw\page} in the middle of text';
proc print data=sashelp.class (obs=1) ;
run;
ods tagsets.rtf text='example of forced page break in rtf between ods text statments';
ods tagsets.rtf text='^{raw \page} ';
ods tagsets.rtf text='following text statement';
ods tagsets.rtf close;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just adding, if you want multiple lines of text to appear on multiple pages, or above tables, then would not titles be better suited?  With some style information, left aligning, bodytitle option etc. you can get lines of text above tables just like ods text without the faff of that. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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