hi i have a huge complex macro program with SAS needs to run for many hours. I want when it finishes to know the total run time.
I mean the time total time from the time i click run till the time i get the final results for all process flows, programs etc..
I want this information to be tracked in the log
Any idea?
%macro dealnum; /*** lots of macros/data steps ***/ %mends;
At the beginning of your code, do this:
%let start_time = %sysfunc(datetime());
At the end, do this:
%put Duration = %sysfunc(putn(%sysevalf(%sysfunc(datetime()) - &start_time),time8.));
At the beginning of your code, do this:
%let start_time = %sysfunc(datetime());
At the end, do this:
%put Duration = %sysfunc(putn(%sysevalf(%sysfunc(datetime()) - &start_time),time8.));
The easiest thing to do is to save the whole program as a file and run it as a separate job from the interactive (or pseudo interactive if you are using a front end processor like Enterprise Guide or SAS/Studio). Then the whole log will reflect the run time.
Otherwise just remember when you started and when you end subtract.
%macro dealnum;
%local startdt ;
%let startdt=%sysfunc(datetime());
/*** lots of macros/data steps ***/
%put NOTE: Run time %sysfunc(putn(%sysfunc(datetime())-&startdt,time16.3));
%mends;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.