BookmarkSubscribeRSS Feed
Cynthia_sas
SAS Super FREQ

Hi,

  With a SAS Stored Process and the SAS Add-in for Microsoft Office, you can insert stored process results into a Word doc (basically ODS output) and then tell the Add-in to refresh the output on open. And, if the data has changed since the last time the stored process was run, the new version of the data would populate the formatted stored process output in the Word doc. So that kind of functionality exists, but you would either need the Office Analytics suite or the Enterprise BI Server suite. Both include the SAS Add-in for Microsoft Office.

  Otherwise, I'm not sure how you would do what you want. Sort of sounds like .NET or VB type of process -- an after the fact process where the SAS output is grabbed via Microsoft technology to update the Word document.

cynthia

PGStats
Opal | Level 21

Ouch! I was looking for a way to simplify my life :smileylaugh:!

Thanks all for your ideas! I think I'll quit on that one.

PG

PG
Haikuo
Onyx | Level 15

LOL, PG, I hear ya! But as a matter of fact, the way that Cynthia suggested is fairly straightforward if you have those products installed. Do note that EBI platform etc are designed in such a way that those who do not have BASE SAS experience are able to pick them up quickly. You probably will be bored for lacking intelligence challenge when using them.

Haikuo

Reeza
Super User

Here's what I tried and what worked and what did not work.

I created an excel file that I exported the SAS output to.

I created a new sheet in the excel file that I can format the table to look nice.

Save the document with the formatted sheet being the sheet on display on close.

In the Word Document, insert object, from file, with 'link to file' selected. 

Save the word document.

Open the excel file and make changes and then close.

The word document asks to be updated when it opens and depending on the selection is updated.

Some issues - updates aren't instantaneous, it seems to take a full minute to refresh the link at least if both files are open.

Second, if the excel file is saved with a different tab active then that tab is displayed not the formatted one.

I can only see this working for one table though, if you're doing more than one table you'd need a more robust method. I'll be interested in seeing Johns solution.

bentleyj1
Quartz | Level 8

I'm going to be presenting a paper at SGF in San Francisco next month on _reading_ Word documents into SAS and the process can be reversed to write SAS data to a Word document but I don't cover it.  The trick is setting bookmarks in Word--such as bookmarking a table--and then running SAS so that it outputs data into the bookmarked table.  You don't have to worry about how many rows are in the data set because a bookmarked table is dynamic in terms of rows.

I'd rather not post the paper here but if you send me your email address I'll send you an advance copy.  john.bentley@wellsfargo.com

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
  • 19 replies
  • 7942 views
  • 6 likes
  • 8 in conversation