Published on :
Macro CREATION_INTERNE

Macro mp_perflog - Performance Logging

This code is also available in: Deutsch Español Français
Awaiting validation
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!
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!
1PROC 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)