BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Toni2
Lapis Lazuli | Level 10

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.));

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

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.));
Toni2
Lapis Lazuli | Level 10
thank you 🙂
Tom
Super User Tom
Super User

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;

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2361 views
  • 2 likes
  • 3 in conversation