This sample shows how to add code in SAS Enterprise Guide that will write a SAS log file and ODS listing file to disk each time that a SAS program is run from SAS Enterprise Guide.
By default, SAS Enterprise Guide project files retain the log files and results generated by user-written code and tasks. However, many SAS customers use SAS Enterprise Guide for running their production SAS programs instead of building reports by using the point-and-click interface.
This sample can be helpful for those SAS Enterprise Guide users who work in industries such as pharmaceuticals that require separate documentation in the form of SAS log files and SAS output files for each job execution, instead of the logs and outputs embedded in a SAS Enterprise Guide project file.
The following image shows the Options window.
The following image shows the Edit window.
options dtreset fullstimer;
%let SAS_ListingDateTimeStamp = SAS_Listing_%sysfunc(putn(%sysfunc(date()),yymmdd10.))__%sysfunc(translate(%sysfunc(putn(%sysfunc(time()),timeampm12.)),.,:));
%let ListingOutFile = C:\temp\test\&SAS_ListingDateTimeStamp..txt;
ods listing file="&ListingOutFile";
%let SAS_LogDateTimeStamp = SAS_Log_%sysfunc(putn(%sysfunc(date()),yymmdd10.))__%sysfunc(translate(%sysfunc(putn(%sysfunc(time()),timeampm12.)),.,:));
%let LogOutFile = C:\temp\test\&SAS_LogDateTimeStamp..txt;
filename logfile "&LogOutFile";
proc printto log=logfile;
run;
|
Note: In order to use the exact code above, make sure you have write access to the path C:\temp\test
on your SAS server; otherwise, modify the path in the code accordingly to point to a valid path.
The following image shows the Edit window.
proc printto;
run;
|
proc print data=sashelp.class;
run;
|
The following image shows the Log and Listing files were created. Notice that they are labeled nicely with a Date and Time stamp.
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.
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 shows how to add code in SAS Enterprise Guide that will write a SAS log file and ODS listing file to disk each time that a SAS program is run from SAS Enterprise Guide.
Type: | Sample |
Date Modified: | 2008-05-16 11:20:14 |
Date Created: | 2008-05-14 13:34:35 |
Product Family | Product | Host | Product Release | SAS Release | ||
Starting | Ending | Starting | Ending | |||
SAS System | SAS Enterprise Guide | Microsoft Windows Server 2003 Datacenter Edition | 4.1 | 9.1 TS1M3 SP4 | ||
Microsoft Windows Server 2003 Enterprise Edition | 4.1 | 9.1 TS1M3 SP4 | ||||
Microsoft Windows Server 2003 Standard Edition | 4.1 | 9.1 TS1M3 SP4 | ||||
Microsoft Windows XP Professional | 4.1 | 9.1 TS1M3 SP4 |