BookmarkSubscribeRSS Feed
Datalys
Calcite | Level 5

I was asked by my superior (a non-SAS user) about the existence of SAS add-on that allows a programmer to directly output SAS results in a word document. I know ODS can output to spreadsheets, pdfs, and rtfs, but I've never heard of any code, product, or add-on that allows output to be directly written to a docx. Does such a thing even exist?

Thanks.

5 REPLIES 5
Tom
Super User Tom
Super User

There is a SAS add-on to Microsoft Office that allows you to embed inside of Word logic that can connect to SAS server and run stored processes so that results are returned inside word.  

Otherwise you are correct. If you produce output from SAS program it will need to be converted by Word.  RTF is the normal format for producing output that Word can read.  You can produce RTF format using ODS RTF statements.

art297
Opal | Level 21

Not quite the same but you can always create an rtf file and simply make the extension docx.

e.g. (from Chevell Parker's paper http://support.sas.com/resources/papers/proceedings11/250-2011.pdf 😞

ods tagsets.rtf file="c:\temp.docx"

options(doc="help"

sect="none"

trhdr="\trrh800"

trowhdrcell="\cltxbtlr");

proc print data=sashelp.class style(obsheader header)={just=l};

run;

ods tagsets.rtf close;

Cynthia_sas
Diamond | Level 26

Hi:

  Also, the SAS Add-in for Microsoft Office (part of the SAS Platform for Business Analytics) does allow you to run regular tasks and wizards against your data (described in the metadata) and then get the results returned to you to Word, Excel, PowerPoint or Outlook - -this means that you would be already inside a .DOCX, .XLSX, .PPTX, etc file when the results came back to you. You would only use ODS if you running a stored process and returning the results to the client application (the SAS Add-in for Microsoft Office application).

   But, with a Base SAS installation, creating ODS RTF files is generally an accepted way to create output for Microsoft Word.

cynthia

Vince_SAS
Rhodochrosite | Level 12

The SAS Add-in for Microsoft Office that Cynthia mentioned is also available as part of the SAS Office Analytics package:

http://www.sas.com/technologies/bi/office-analytics.html

http://blogs.sas.com/content/sastraining/2012/03/19/sas-office-analytics-my-own-personal-easy-button...

Vince DelGobbo

SAS R&D

ghastly_kitten
Fluorite | Level 6

Actually, it depends on what type of results you need to embed in word.

We use this logic in a company: by using COM interface we connect to SAS from Word's VBA and run necessary code to produce data (in csv, xls or whatever) in a certain location.

Then this data is imported to word/excel using vba, and creating of all required objects is performed.

Last - you just (also with VBA) insert all results which are already in MS native formats to a certain place in a Word document template.

Kind of messy from the first glance... but we don't have SAS BI since it costs 'like an airplane wing'. Moreover, once implemented it's quite easy to use.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 7945 views
  • 0 likes
  • 6 in conversation