Run Duration in SAS enterprise miner

149 views Asked by At

I have the following problem. We have several streams in Enterprise Miner and we would like to be able to tell how long was each run. I have tried to create a macro that would save the start and end time/date but the problem is that global variables defined in a node, are not seen anymore in a subsequent node (so are global only inside a node, but not between nodes). How people usually solve the problem? Any idea or suggestion?

Thanks, Umberto

1

There are 1 answers

2
Altons On BEST ANSWER

Just write out timestamps to log (EM should produce a global log in the same fashion that EG and DI do)

Either use:

data _null_;  
 datetime = datetime();
 put datetime= datetime20.;
 run;

or macro language:

%put EM node started at at %sysfunc(time(),timeampm.) on %sysfunc(date(),worddate.).;

with a higly customised message you have read the log in SAS looking for those strings using regex.

Solution 2:

Other option is to created a table in a library that is visible from EM and EG for example and have sql inserts at the beginning/end of your process.

proc sql;
create table EM_logger 
    (jobcode char(100),
     timestamp num informat=datetime20. format=datetime20.);
quit;
proc sql;
insert into EM_logger values('Begining Linear Reg',%sysfunc(datetime()));
quit;

data w;
do i=1 to 10000000;
output;
end;
run;

proc sql;
insert into EM_logger values('End Linear Reg',%sysfunc(datetime()));
quit;

Table layout can be as complex as you want and as long as you can access it you can get your statistics.

Hope it helps