BookmarkSubscribeRSS Feed
Jchapman
Calcite | Level 5

I am trying to have SAS compute execution time for a stored process which simply includes a SAS program file. I was able to do this with very simple program but when the program was more complex (includes macros, sql junk, etc) I have problems. SAS for some reason does not create a data file? Also, do stored processes have a macro variable defined for execution time that I can access?

Code registered as stored process in metadata follows:

%global startdatetime;

%global executeSAStime;

%let startdatetime= %sysfunc(datetime());

%put &startdatetime;

%STPBEGIN;

%include "C:\code\goes\here.sas";

%put &startdatetime;

%let executeSAStime= %sysfunc(round(%sysevalf(%sysfunc(datetime())-&startdatetime),0.01));

%put &executeSAStime;

%let rc=0;

%include "D:\SAS\users\jchapman1\test\append.sas";

%STPEND;

;

quit;

The append program creates a dataset and appends it to a sql database. However, the datastep used does not seem to be making the dataset for the complex program while it does for the simple one. Very confusing.

400 +%put &_METAUSER;

thisisme@safdasdf

401 +%put &_username;

Test User

402 +%put &_program;

/Shared Data/StoredProcName

403 +%put &startdatetime;

1726172330.329

404 +%put &executeSAStime;

176.38

405 +%put &rc;

0

406 +

407 +*create dataset;

408 +data newtempfile;

409 +length client username $16. Program $30. datetime exectime rc 8. ;

410 +client="&_METAUSER.";

411 +username="&_username.";

412 +program="&_program.";

413 +datetime=&startdatetime.;

414 +exectime=&executeSAStime.;

415 +rc=&rc.;

416 +run;


NOTE: The data set WORK.NEWTEMPFILE has 0 observations and 6 variables.
NOTE: DATA statement used (Total process time):
  real time 0.00 seconds
  cpu time 0.01 seconds


Please help!

1 REPLY 1
jakarman
Barite | Level 11

what you are trying to do is standard part of ARM.
The log4j is a well known interface. APM and Eventmananager are build on top of this. When activated ill you are trying to build is already there.

http://support.sas.com/documentation/cdl/en/armref/62980/HTML/default/viewer.htm#n1x1n1iiwv8l6jn199y...

---->-- ja karman --<-----

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 1669 views
  • 0 likes
  • 2 in conversation