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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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