The `mp_perflog` macro allows logging messages with precise timestamps and the system job ID. It is designed to be robust: it checks for the existence of the storage table (by default `work.mp_perflog`) using the `%mf_existds` macro and automatically initializes it if it is absent. Data insertion is performed via `PROC SQL`.
Data Analysis
Type : CREATION_INTERNE
The storage table is managed internally: it is created by the script during the first call if it does not exist.
1 Code Block
DATA STEP Data
Explanation : Conditional check for the existence of the target table. If it does not exist, a Data Step creates the empty structure with `sysjobid`, `label`, and `dttm` columns.
Copied!
%if not (%mf_existds(&libds)) %then %do;
data &libds;
length sysjobid $10 label $256 dttm 8.;
format dttm datetime19.3;
call missing(of _all_);
stop;
run;
%end;
1
%IF not (%mf_existds(&libds)) %THEN %DO;
2
DATA &libds;
3
LENGTH sysjobid $10 label $256 dttm 8.;
4
FORMAT dttm datetime19.3;
5
call missing(of _all_);
6
stop;
7
RUN;
8
%END;
2 Code Block
PROC SQL Data
Explanation : Adds a new row to the log table containing the system job ID, the checkpoint label, and the current timestamp.
Copied!
proc sql;
insert into &libds
set sysjobid="&sysjobid"
,label=symget('label')
,dttm=%sysfunc(datetime());
quit;
1
PROC SQL;
2
insert into &libds
3
SET sysjobid="&sysjobid"
4
,label=symget('label')
5
,dttm=%sysfunc(datetime());
6
QUIT;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Allan Bowe, SASjs Core (https://github.com/sasjs/core)
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.