Macros for SAS Application Developers
https://github.com/sasjs/core
mp_perflog.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Logs a message in a dataset every time it is invoked
4  @details If the dataset does not exist, it is created.
5  Usage:
6 
7  %mp_perflog(started)
8  %mp_perflog()
9  %mp_perflog(startanew,libds=work.newdataset)
10  %mp_perflog(finished,libds=work.newdataset)
11  %mp_perflog(finished)
12 
13 
14  @param [in] label Provide label to go into the control dataset
15  @param [in] libds= (work.mp_perflog) Provide a dataset in which to store
16  performance stats. Default name is <code>work.mp_perflog</code>;
17 
18  @version 9.2
19  @author Allan Bowe
20  @source https://github.com/sasjs/core
21 
22 **/
23 
24 %macro mp_perflog(label,libds=work.mp_perflog
25 )/*/STORE SOURCE*/;
26 
27  %if not (%mf_existds(&libds)) %then %do;
28  data &libds;
29  length sysjobid $10 label $256 dttm 8.;
30  format dttm datetime19.3;
31  call missing(of _all_);
32  stop;
33  run;
34  %end;
35 
36  proc sql;
37  insert into &libds
38  set sysjobid="&sysjobid"
39  ,label=symget('label')
40  ,dttm=%sysfunc(datetime());
41  quit;
42 
43 %mend mp_perflog;