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

When I run my program, the output looks great in the browser. But when I paste the results into Word, the tables are very narrow and only fill about half the page.  How can I adjust this with SAS code so that the results are easier to read when pasted into Word. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
collinelliot
Barite | Level 11

See ballardw's comment below. That should do what you want.

View solution in original post

10 REPLIES 10
collinelliot
Barite | Level 11

I would send my output to an RTF using the appropriate ODS statements. Then that file should have output that is far easier to put into Word.

 

For example:

 

ods rtf file = "YourPath\YourFileName.rtf";

 

Your SAS code to create output...

 

ods rtf close;

 

There's a lot you can do to customize your output to minimize how much you need to do manually after creating it, but that's another topic.

vicdicenzo
Obsidian | Level 7

Thanks. I am unfamiliar with that code? Where in the program does it go? Can you provide more details?

collinelliot
Barite | Level 11

Here's a simple example:

 

ods rtf file = "c:\my_sas_output.rtf";

 

proc print data = sashelp.class;

run;

 

ods rtf close;

 

You'd then go to Windows explorer to your C drive and open the file. Change the path and file name to reflect what you really want, of course.

vicdicenzo
Obsidian | Level 7

Thanks again - does that go at the very end of the code or up near the beginning where the files are brought in?

collinelliot
Barite | Level 11

Put the "sandwich" around whatever output you want to send the file.

 

Every output generated between the "ods rtf..." and "ods rtf close;" will end up in the specified file. So if you put the opening of the sandwich at the the top of the code and the ods close at the bottom, all generated output will go into that RTF. That might be more than what you want, of course. Also note that you'll also get the default output, too, unless you close other ods destinations.

vicdicenzo
Obsidian | Level 7

Thank you, I was able to get that to work. However, I lost all the titles to my output tables.  Is there anyway to get those to print? Thanks.

ballardw
Super User

Please show the code you ran.

ODS RTF by default will place title statements in the HEADER area of a Word document, or footnotes into the Footer area.

use option bodytitle to have the titles appear in the body of the document. Such as

 

ods rtf file="c:\path\myfile.rtf" BODYTITLE;

<your report code here>

ods rtf close;

collinelliot
Barite | Level 11

See ballardw's comment below. That should do what you want.

vicdicenzo
Obsidian | Level 7

Thank you

collinelliot
Barite | Level 11

You're welcome. This is just the tip of the iceberg in terms of what you can do with ODS, so keep at it. 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 16855 views
  • 0 likes
  • 3 in conversation