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?
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
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.
: 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.
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
Hi PG,
Do you think mail merge would work?
I'm not familiar with mail merge. Can whole tables be inserted with it? - PG
Hi PG,
I tried. I can only insert a row from a table not the whole table. Sorry.
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?
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.
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
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.
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 :
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.