Using PrintTo to Save Logs

From sasCommunity

Jump to: navigation, search

This article describes how to route logs and output of routines and subroutines called by a module to named files with the form:

<SysIn>-<(Sub)Routine>.log
* name: Module;

%Let RoutineName = a;
%Include SiteIncl(LogRoutine);
%Include Project(&RoutineName.);
Proc PrintTo;

%Let RoutineName = b;
%Include SiteIncl(LogRoutine);
%Include Project(&RoutineName.);
Proc PrintTo;
* name: autoexec;
filename Project  '.';* here;
filename SiteIncl '<directory-spec>';* of LogRoutine;
* name: LogRoutine;
* description: write log to another file; 
* purpose    : redirect large module log to smaller logs;
%Let JobName = %scan(%sysfunc(getoption(SysIn)),-2,./\);
Proc PrintTo log   = "&Jobname.-&RoutineName..log"
             print = "&Jobname.-&RoutineName..lst"
             new;

reference: http://www.sascommunity.org/wiki/Saving_sas_logs

NOTE: As of 2008-Jul-29 this is untested code.

--macro maven == the radical programmer 15:49, 29 July 2008 (EDT)

Personal tools