SAS/AF Reading Data in Document Tables
This example is for systems where Microsoft Office is also installed. It is untested for cases where only the freely distributed Word Viewer is installed.
The class example.office.Wordtable_m can open a document and read data from it's tables. A frame is used to input the document filename and table number and the tables data is show in preview. The data can be saved to a SAS data set. When saved all data is character. Further work would be needed to interpret the data for appropriate variable type, length and format.
Consider a document created using ODS RTF.
ods noresults; ods rtf file="c:\temp\class.rtf"; proc print noobs data=sashelp.class; proc print noobs data=sashelp.class; where name <'H'; proc print noobs data=sashelp.class; where name >='H'; run; ods rtf close; dm "afa c=example.office.wordtable.frame";
The frame is run, the document is opened, the second table is selected and it's data is shown in the table viewer.
Installation
This example is designed to be installed in catalog example.office. The test frame is example.office.wordtable.frame.
The source code of the class that interfaces with Word is example.office.wordtable_mclass.scl. Modifications to this class source must be recompiled using the
SAVECLASS
command.