BookmarkSubscribeRSS Feed
PGStats
Opal | Level 21

Hi fellow Forum members,

I would like to link to SAS output tables from MS-Word documents. I tried creating the tables into a RTF document with anchors using ODS and then referring to these anchors from my Word report. That didn't work. I can create a hyperlink to the table in the RTF document but I can't make the table appear in my report. Can it be done?

PG
19 REPLIES 19
art297
Opal | Level 21

: from word, if you click on insert and then on the icon shown below, followed by "Text from File", you can insert rtf and html files into word documents:

word_menu.jpg

PGStats
Opal | Level 21

Thanks Art for the detailled instructions. I tried that and it didn't include anything into my Word document (it didn't signal any error). Does it work for you? I'm using SAS 9.3 and Word 2007.

- PG

PG
art297
Opal | Level 21

Yes it did work for me.  I'm using Word 2010.  However, it wouldn't update the document when the html or rtf document changed.

If you can attach one of the files, I'll see if it works on that particular file.

art297
Opal | Level 21

: Try following the instructions shown in the following link: Automatically Updating Text in Many Documents

This actually links the files with the new document so that the document is updated when anything in the link changes.  The instructions, basically, are just to:

1. Create a document containing the text you want to link to

2. Copy the text you would like to insert in your other documents

3. Open the document where you would like to insert the text

4. Place the cursor where you would like the text to appear

5. From the Edit menu, select Paste Special

6. From the Paste Special dialog box, select Paste Link

I tested it, at least in Word2010, by inserting an HTML document into the new document.  I presume it should work with rtf as well.

PGStats
Opal | Level 21

Hi Art,

Thanks for your time and ideas. Like so many half baked features in MS-Office, this one almost looks like it works. When I paste a link to my table, Word inserts a new bookmark in the RTF file. It call it OLE_LINK1. It doesn't use the bookmark that was inserted by SAS for the same table. If I edit the RTF file with Word, the edits will be carried over to my report. But this also means that when I update the RTF file by running my SAS program again, the inserted link (OLE_LINK1) is lost and the link is broken.

PG

PG
Linlin
Lapis Lazuli | Level 10

Hi PG,

Do you think mail merge would work?

PGStats
Opal | Level 21

I'm not familiar with mail merge. Can whole tables be inserted with it? - PG

PG
Linlin
Lapis Lazuli | Level 10

Hi PG,

I tried. I can only insert a row from a table not the whole table. Sorry.

Peter_C
Rhodochrosite | Level 12

could a hyperlink in the word doc open a SAS table in the SAS Universal Viewer, and would that be of adequate quality of presentation?

art297
Opal | Level 21

: Methinks that is one for SAS to take care of, namely offering to maintain links when a file is replaced.

Reeza
Super User

Hi PG,

Can you explain a bit more of what you're trying to do?

What do you mean by a SAS Table? Is it in another word document and what kind of link are you looking for.

PGStats
Opal | Level 21

A SAS table is the formatted version of an ODS dataset. I guessed the RTF version of a table would be the most compatible with Word.

I am looking for an updatable (dynamic?) link. If I redid the analysis in SAS, I would like to see the updated version in my Word report.

PG

PG
Reeza
Super User

Is that still a SAS dataset, ie sas7bdat file?

You can embed an excel table into a word document. And if you update the source excel table via SAS either through a simple proc export, DDE or other manner it should update in Word as well.

PGStats
Opal | Level 21

Thanks for the suggestion Reeza, but a raw data table is not what I need to include in my report.

It's the formatted version of a SAS table that I want to link to, something like :

Capture Report.PNG

It would be part of a RTF file and pointed to within the file by an anchor name. I can bring such a table from the RTF output to my report with cut and paste but I would like to make the process automatic.

PG

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!

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
  • 7847 views
  • 6 likes
  • 8 in conversation