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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.