Write and run SAS programs in your web browser

pasting output in Word

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

pasting output in Word

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.


Accepted Solutions
Solution
‎03-03-2017 03:31 PM
Super Contributor
Posts: 259

Re: pasting output in Word

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

View solution in original post


All Replies
Super Contributor
Posts: 259

Re: pasting output in Word

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.

Occasional Contributor
Posts: 10

Re: pasting output in Word

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

Super Contributor
Posts: 259

Re: pasting output in Word

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.

Occasional Contributor
Posts: 10

Re: pasting output in Word

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

Super Contributor
Posts: 259

Re: pasting output in Word

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.

Occasional Contributor
Posts: 10

Re: pasting output in Word

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.

Grand Advisor
Posts: 9,740

Re: pasting output in Word

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;

Solution
‎03-03-2017 03:31 PM
Super Contributor
Posts: 259

Re: pasting output in Word

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

Occasional Contributor
Posts: 10

Re: pasting output in Word

Thank you

Super Contributor
Posts: 259

Re: pasting output in Word

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

Post a Question
Discussion Stats
  • 10 replies
  • 161 views
  • 0 likes
  • 3 in conversation