- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm relatively new to SAS, and recently discovered the ODS function. Currently, I've been copy and pasting a SAS output into different tables in a Word document, and was hoping to try and automate the process by loading up the template and having SAS output the data directly into a Word document into predefined tables.
I've done a bit of Googling have so far only found this paper. Admittedly I found it a bit hard to follow. Are there many other examples around of this being done?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The paper from 2003 uses DDE, which has since been deprecated by Microsoft.
You can use styles in ODS RTF and ODS WORD (at this time, WORD is still pre-production).
You cannot write to an exu'isting file, you always create a new one, so the whole document needs to be created by your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The best way to incorporate SAS and Microsoft Office files is to pull the data into Office vs pushing it from SAS. There are numerous libraries out there, some free/some not, that handle MS Office documents. SAS datasets are ODBC-compliant so you can write SAS then pull the data into a MS Office file. I use C# and the GemBox library but there are free alternatives in the C# and Python landscapes.
Personally, I have automated Word, Excel, PowerPoint, Project, and Visio with SAS data. I have not pushed from SAS at any of those client engagements.
I don't have a paper on using Word specifically since Word is not used as often. However, see this code bit on GitHub to see Excel in action: savian-net/ExcelSasDemo (github.com). Chris Hemendinger also has lots of papers on SAS in .NET/PowerShell. If you need a demo for Word, I can probably put something together but the main idea is to pull vs push, Office pulling SAS data, not SAS pushing out Word.
Word is better at Word. Once SAS has the data in the form you need, it is just a table with rows/columns.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Our SAS hackathon project may help, it can inject values (not necessary to be a full table/dataset) into a Word paragraph, Word table, Word chart, including images.
SAS Hackathon 2022 - RepTik Analytics Solution, www.reptik.swiss
Easy report generation cross-platform. Create, format, and modify your tables & reports with the ease of Office Software and fill in with data from any source automatically via RepTik PDR technology.