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

Hello,

I am trying to force page breaks but the ods rtf startpage= now statement doesn't seem to be working. This is a simplified version of my code:

ods rtf file = "hello.rtf" style= styles.hello startpage= yes; *(tried =on too);
	ods escapechar = '^';
	options nodate nonumber;

	ods rtf text= "hello &hello.";

	ods rtf startpage= now;

	ods rtf text= "hello &hello.";

ods rtf close;



Everything is on the same page in the output rtf.

Probably I'm doing something stupid but would appreciate if someone can point it out.

 

Thanks!!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I would use a data set and proc print to push text or PROC ODSTEXT but when I last tested it, it has the same issues as ODS TEXT. 

 

View solution in original post

10 REPLIES 10
Reeza
Super User

ODS TEXT statements don't get processed until they encounter a run or quit so that's likely your issue - with your test, not the functionality of STARTPAGE. Try doing this with PROC PRINT instead.

 

%let hello = Reeza;

ods rtf file = "hello.rtf" style=meadow startpage=no; *(tried =on too);
	ods escapechar = '^';
	options nodate nonumber;

	ods rtf text= "hello &hello.";
    proc print data=sashelp.class;
    run;

	ods rtf startpage= now;

	ods rtf text= "hello &hello.";
    proc print data=sashelp.air (obs=10);
    run;

ods rtf close;
sm4
Quartz | Level 8 sm4
Quartz | Level 8
Thanks very much for your response!
I can't test this idea out till I have access to SAS again on Monday, but
wanted to clarify first - does this mean I can't force page breaks if I
only want to use text= statements? I see you didn't change the text=
statement itself, so it looks like there isn't a way to use it alone.

Thanks again for your time!
Reeza
Super User

I would use a data set and proc print to push text or PROC ODSTEXT but when I last tested it, it has the same issues as ODS TEXT. 

 

sm4
Quartz | Level 8 sm4
Quartz | Level 8
I see. I guess another way is to add the right number of spaces you need to
force a page break.
Will test out on Monday and follow up here.

Thanks!
Reeza
Super User

Or use/force in RTF tags is another option. 

sm4
Quartz | Level 8 sm4
Quartz | Level 8
By tags do you mean control words? If so, I don't see any option for page
breaks. And actually I've never been able to get control words to work at
all.
(Sorry, still teaching myself all this)

Thanks!
sm4
Quartz | Level 8 sm4
Quartz | Level 8

Proc odstext does solve the page break issue for me 🙂

But it brings up text justification issues 😞 Will start a new thread for that, I guess.

sm4
Quartz | Level 8 sm4
Quartz | Level 8

This code works as expected, tried with a blank dataset. I guess I can use this as a workaround by trying to make the dataset invisible, if that's possible. Will keep fiddling and update here.

 

Thanks!

ballardw
Super User

You might want to investigate using Proc ODSTEXT instead of ODS RTF Text. The output doesn't depend quite so much on another procedure creating ODS output as ODS RTF TEXT seems to.

sm4
Quartz | Level 8 sm4
Quartz | Level 8

Will check this out and update here.

Thanks!

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
  • 10 replies
  • 3279 views
  • 1 like
  • 3 in conversation