Sample 51626: How to write the contents of the SAS® log or other text output to an HTML, RTF, or PDF file
The SAS log window is not an ODS destination, so it cannot be routed directly to an HTML, RTF, or PDF file. A text file can be created from the SAS log using PROC PRINTTO. The output from the text file can then be replayed to any ODS destination using the IMPORT statement in PROC DOCUMENT.
The sample code on the Full Code tab illustrates how to route the text from the SAS log to ODS PDF. The logic is also applicable to SAS code as well as text output written to the SAS Output window (ODS Listing).
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
A text file can be created from the SAS log using PROC PRINTTO. The output from the text file can then be replayed to any ODS destination using the IMPORT statement in PROC DOCUMENT. The sample code below illustrates how to route the text from the SAS log to ODS PDF. The logic is also applicable to SAS code as well as text output written to the SAS output window (ODS Listing), as the IMPORT statement can be used with any text file.
filename test "c:\temp\log.log";
proc printto log=test new;
run;
proc print data=sashelp.class;
run;
proc report nowd data=sashelp.cars;
run;
proc printto; run;
proc document name=mydoc(write);
import textfile=test to logfile;
run;
ods listing;
/* Take a look at the entry in MYDOC */
proc document name=mydoc;
list;
run;
ods listing close;
/* Replay the output to the PDF destination */
options nocenter nodate nonumber;
ods pdf file="log.pdf" notoc;
replay;
run;
ods pdf close;
options center date number;
run;
quit;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to write the contents of the SAS
® log to an HTML, RTF, or PDF file. The logic is applicable to SAS code as well as text output written to the SAS Output window (ODS Listing).
Date Modified: | 2013-11-18 13:10:10 |
Date Created: | 2013-11-15 09:40:11 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |