Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
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 <h4> SAS Macros </h4>
19 @li mf_existds.sas
20
21 @version 9.2
22 @author Allan Bowe
23 @source https://github.com/sasjs/core
24
25**/
26
27%macro mp_perflog(label,libds=work.mp_perflog
28)/*/STORE SOURCE*/;
29
30 %if not (%mf_existds(&libds)) %then %do;
31 data &libds;
32 length sysjobid $10 label $256 dttm 8.;
33 format dttm datetime19.3;
34 call missing(of _all_);
35 stop;
36 run;
37 %end;
38
39 proc sql;
40 insert into &libds
41 set sysjobid="&sysjobid"
42 ,label=symget('label')
43 ,dttm=%sysfunc(datetime());
44 quit;
45
46%mend mp_perflog;