Using TermStmt for Bench Marking
From sasCommunity
This article describes the usage of option TermStmt in order to save total Job Times. This approach is used rather than saving and reading the job log to get the total job time.
TermStmt inserts statement(s) before end of job.
See also: autoexec, initstmt.
/*name: sasv91.cfg */ -config 'C:\Program Files\SAS\SAS 9.1\SASv9.cfg' -SASinitialFolder '.' /* *** * -termstmt "%inc 'SaveJobTime.sas';" -log '..\log91\' -print '..\log91\' /* *** */ -noovp -nosplash
/*name: sasv92.cfg */ -config 'C:\Program Files\SAS\SASfoundation\9.2\SASv9.cfg' -SASinitialFolder '.' /* *** */ -termstmt "%inc 'SaveJobTime.sas';" -log '..\log92\' -print '..\log92\' /* *** */ -fullstimer -msglevel = I -noovp -nosplash
/*name : SaveJobTime.sas
description: save job time to date-stamped data set
purpose : automatic logging
usage : called by option termstmt
config:
-set SiteIncl '<directory-specification>'
-termstmt '%Include "!SiteIncl\SaveJobTime.sas";'
options nosource nonotes; run;
DATA _Null_;
retain Testing %eval(0
or %sysfunc(getoption(Source2))
eq SOURCE2 );
if Testing then call execute('options source notes;');
stop; run;
**** *******/
%Put NOTE: TermStmt processing beginning;
%sysfunc(ifc(%sysfunc(getoption(EchoAuto)) eq ECHOAUTO
and %sysfunc(getoption(Verbose )) eq VERBOSE
,%nrstr(options notes source;)
,%nrstr(options MsgLevel= N nonotes nosource;)
))
Data JobTime;
attrib %*composite key;
DateTime length = 8 format = datetime20.2
SysId length = 4
SysJobId length = 4
SysScp length = $ %length(WIN)
SysScpL length = $ %length(XP_PRO)
%*foreign keys;
Host length = $20
UserId length = $ 4
Ver length = $ %length(9.01.01M3)
%*facts;
JobTime length = 8 format = 32.2
SysIn length = $80
%*max of steps;
%* SysMaxMem length = 4;
%* SysMaxTimeCpuUser length = 4;
%* SysMaxTimeCpuSys length = 4;
%* SysMaxTimeReal length = 4;
%*job summary;
%* SysJobMem length = 4;
%* SysJobTimeCpuUser length = 4;
%* SysJobTimeCpuSys length = 4;
%* SysJobTimeReal length = 4;
%*option values;
%* SysUseSort length = 4;
%* SysUseSteps length = 4;
%* SysUseSum length = 4;
;
DateTime = input("%substr(&SysProcessId.,1,16)",hex16.);
SysId = %substr(&SysProcessId.,17,4);%*length(9999)==Nusers;
SysJobId = &SysJobId.;
SysScp = "&SysScp.";
SysScpL = "&SysScpL.";
Host = "%sysget(computername)";%*Windows environment variable;
UserId = "&SysUserId.";
Ver = "&SysVlong.";
JobTime = datetime() - DateTime;
SysIn = "%sysfunc(getoption(SysIn))";
output;
stop; run;
;/**********************************************************************
%let DatePart = %sysfunc(datepart(%substr(&SysProcessId.,1,16)x));
%let Year = %sysfunc(year(&Datepart.));
%let Month = %sysfunc(putn(&Datepart., month2.));
%let Month = %sysfunc(putn(&Month. , z2.));
%let MonthName = %sysfunc(putn(&Datepart.,monname3.));
%let Day = %sysfunc(putn(&Datepart., day.));
%let Day = %sysfunc(putn(&Day. , z2.));
Libname JobTimes '!JobTimes';
Proc Append base = JobTimes.Jobs&Year._&Month.&MonthName.&Day.
;/*********************************************************************/
Proc Append base = LibJobs.JobList
data = JobTime;
run; options source notes;
%Put NOTE: TermStmt processing completed;
run;
--macro maven == the radical programmer 10:06, 7 April 2008 (EDT)
