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

Hi,

 

I have noted over time that there is something peculier in the way options are handled on SAS 9.4.  If I take some basic code such as this:

ods rtf file="s:\test.rtf";
options orientation=landscape;
title1 "Hello";
proc print data=sashelp.cars;
run;
ods rtf close;

And run this in a fresh session, the rtf output is portrait, even though the options states landscape.  If I run this code exactly the same again, the landscape instruction seems to take effect and the output is then landscape for that output run and all further ones within the session.  If however I create a news session and run it, back to portrait for the first run only.

It seems like first run options are being set, but not used in the current run.  Could someone help clarify?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I think this works if you set the options before you create the RTF file:

 

options orientation=landscape;
title1 "Hello";
ods rtf file="s:\test.rtf";
proc print data=sashelp.cars;
run;
ods rtf close;

Perhaps ODS RTF statement writes or remembers the options at the time that the statement is executed (the file is opened), rather than when the contents are written.

 

View solution in original post

6 REPLIES 6
gamotte
Rhodochrosite | Level 12

Hello,

 

I think this is because the options have to be set befor the ods instruction.

Rick_SAS
SAS Super FREQ

I think this works if you set the options before you create the RTF file:

 

options orientation=landscape;
title1 "Hello";
ods rtf file="s:\test.rtf";
proc print data=sashelp.cars;
run;
ods rtf close;

Perhaps ODS RTF statement writes or remembers the options at the time that the statement is executed (the file is opened), rather than when the contents are written.

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Thanks @Rick_SAS@gamotte, yes quite true, options after the ods do not seem to effect.  Strange, sure they always used to.  Anyways, will make sure the options are set before the ods in future.

ballardw
Super User

@RW9 wrote:

Thanks @Rick_SAS@gamotte, yes quite true, options after the ods do not seem to effect.  Strange, sure they always used to.  Anyways, will make sure the options are set before the ods in future.


@RW9 I suspect this behavior is related only the options in the ODSPRINT options group. Perhaps the other options you remember working as desired were from a different group. Or is ODSPRINT group new?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its been a while, but I was sure we used to change orientation in outputs during runs within ods.  Although looking back we probably created separate ones and combined in PDF.  Anyways, simplest is to always put options at the start of a program, most are setup at system level anyways.

ChrisHemedinger
Community Manager

There are certain options that you can change while the ODS destination is open, and others that must be in place before you begin.  Page Orientation makes sense (to me) as something that needs to be in place early.  But other items, like the ODS STYLE or PAGENO, can be changed on the fly.

 

options orientation=landscape;
title1 "Hello";
ods rtf file="c:\temp\test.rtf" style=rtf;
proc print data=sashelp.cars (obs=20);
run;

options pageno=10;
ods rtf style=analysis ;
proc print data=sashelp.class;
run;

ods rtf close;
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

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