Desktop productivity for business analysts and programmers

Landscape format for RTF listing

Reply
Occasional Contributor npa
Occasional Contributor
Posts: 16

Landscape format for RTF listing

I am running a proc freq and the output format I selected is RTF. It is generating output in portrait but I want it in landscape, or the smallest font (so my output is not broken up on different pages width-wise). I am opting for the landscape option right now. The problem is: I don't know how to change the setting for the RTF to landscape. Anyone have any ideas on this?
SAS Super FREQ
Posts: 8,721

Re: Landscape format for RTF listing

Hi:
The method for setting orientation is a SAS Option. It works for the LISTING, RTF and PDF destinations:
[pre]
options orientation=landscape;
ods rtf file='somefile.rtf';
... code ..
ods rtf close;
[/pre]

For RTF only, you can CHANGE orientations -- for example, you had one report that you wanted in portrait (perhaps from PROC PRINT) and then a second report in the same document that you wanted in landscape (perhaps from PROC TABULATE). This Tech Support note explains how to do that:
http://support.sas.com/kb/24/559.html

cynthia
Occasional Contributor npa
Occasional Contributor
Posts: 16

Re: Landscape format for RTF listing

Hi Cynthia,

Yes, now I remember the options statement. But I was not aware of the syntax for the ods stuff.

Thanks.
SAS Super FREQ
Posts: 8,721

Re: Landscape format for RTF listing

Hi:
A lot of the SAS options can be set inside EG, but some have to be specified in code or by inserting them in your task. Generally, EG generates the ODS "sandwich" statements for you -- so if you select RTF under the EG options menu, (the menu choice to select output type), then you will never see the ODS RTF "sandwich" statements.

To add the OPTIONS statement to your task code, then while you're still inside your task and before you do the submit, select the "Preview Code" button. When the preview window opens, look for the button that says "Insert Code" and click it. Then, when you scroll through the generated code, you will see places marked in gray where you can insert your own code. At the top of the file, look for the first place to insert code ABOVE a PROC step. (A SAS Options statement cannot bet inside a PROC step.) Then, double click on the gray line for to enter insertion mode.

Once the custom code window opens, type: [pre]
options orientation=landscape;
ods rtf;
[/pre]

The above 2 lines are needed if you have selected RTF as the result type because normally, your options statement would be outside the ODS RTF sandwich. When you're in EG, you never actually see the ODS RTF sandwich -- so you have to tell ODS RTF to pay attention to the changed option. That's what the ODS RTF; statement does -- it's just alerting ODS RTF to the fact that you've issued a new option.

You could also put this code into a custom code node to be submitted before EVERY task, but this is probably not a good idea, since you may not want EVERY task going to an RTF file or in landscape mode.

cynthia
Valued Guide
Posts: 2,111

Re: Landscape format for RTF listing

Cynthia describes the sandwich of code that EGuide wraps around the task code. Is there a way to 'turn off' the sandwiching? When I insert the

OPTIONS ORIENTATION=LANDSCAPE;
ODS RTF;

in my code node, I suddenly get two (identical) RTF documents in the project and the process flow looks really messy. The second file is named
c:\windows\system32\sasrtf.rtf (it seems a strange place and potential security flaw) for every task. There is only one file, the last task run 'wins', but the icon is there for every task.

Turning off the sandwich may not be the right way to solve the problem, so I'm open to other ideas. Or is this a problem for tech support?

Thanks,
Doc



Thanks,
Doc
SAS Super FREQ
Posts: 8,721

Re: Landscape format for RTF listing

Hi:
You might try leaving off the ODS RTF statement and just put the options statement. The time I tested this, I needed the extra ODS RTF statement to make landscape take effect. Depending on where you set the option, you may not need it (the blank ODS RTF statement).

The other thing you could try is just entering the ods _all_ close; to close what eg has opened up.

ods _all_ close;
options orientation=landscape;
ods rtf file='theoutput.rtf';
code;
ods rtf close;

Otherwise, if you're still generating multiple files, then contacting Tech Support would be the next step.

cynthia
Valued Guide
Posts: 2,111

Re: Landscape format for RTF listing

It's on to tech support. I'll update this post when I get a response.
Community Manager
Posts: 2,697

Re: Landscape format for RTF listing

Here's how you can turn off the EG ODS "sandwich" (so that you don't get two helpings of results):

1. In the process flow or project tree, select the code item or task that you want to affect, right-click and choose Properties.

2. In the Properties window, select the Results tab.

3. Check "Override the preferences set in Tools->Options".

4. Uncheck (clear) all Results Formats items.

Then when you add your own ODS statements, those should be the only results that you see.

Chris
Valued Guide
Posts: 2,111

Re: Landscape format for RTF listing

OK, here is my summary.

Using the techniques that Cynthia and Chris stated, I turned "off" the EGuide sandwich. I pasted the sandwich code back into my program. However, I found that turning off the sandwich turns off a lot more than just the code (the "law" of unintended consequences).

I got down to one file. It was uniformly named EGRTF for every output (as I had just copied the sandwich code). When I changed the name, it put it on my c-drive. The name was also limited to 8 characters (as it was now being picked up through the FILENAME statement).

The long term solution probably needs to be an option in Tools to specify landscape.

Thanks, everyone, for your help.
Valued Guide
Posts: 2,111

Re: Landscape format for RTF listing

Martin, in tech support, also sent this. Either work well for setting the default output to LANDSCAPE.

"If you know that you want the default orientation for your output to be in landscape mode, one option is for you to add the following OPTIONS statement to your egauto.sas file:

Options Orientation=Landscape;

You will find your egauto.sas file in:

C:\Documents and Settings\your-userid\Application Data\SAS\Enterprise Guide\4

The first time after making this change, you will need to stop and restart Enterprise Guide. Another option is to do the following...

From the Enterprise Guide pulldown options menu, select TOOLS and then OPTIONS. Then, on the left-hand side, select SAS PROGRAMS. On the right-hand side, click the checkbox to the left of the option titled:

Insert custom SAS code before submitted code.

Then, click the EDIT box to the right of the label above and in the custom code window, add:

Options Orientation=Landscape;

Then, click SAVE and then OK. "
N/A
Posts: 0

Re: Landscape format for RTF listing

Doc@Duke,
Thanks so much for your post. I followed all the examples shown in the posts, but for some reason your post is the one that resolved my issue. Thanks for taking time to post your responses to help out a "noob".

Christine
Ask a Question
Discussion stats
  • 10 replies
  • 214 views
  • 0 likes
  • 5 in conversation