4 users online | 4 Guests and 0 Registered

Can I produce a report to show the run-time of my SAS Program?


Yes.  Treat the SAS LOG as a raw data file and it is quite possiblt to read in the run time and cpu time data.  Although there is a lot of text in a SAS LOG, these two numeric values are always found in the same place.

A short LOG extract may look something like this:

394     ;
NOTE: Table MYBIGSASDATA created, with 834847 rows and 2 columns.
395   quit ;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:20:31.36
      cpu time            15:53.20

From which it can be seen that the run time follows the phrase real time and the CPU time follows the phrase cpu time.

Using these as 'triggers' to identify a named position with the INFILE statement.  Specify the SCANOVER option on the INFILE statement (actually the default action - but it helps to reinforce the action of reading across multiple lines of the LOG searching for the positional triggers.)

The code might look something like this:

filename saslog '\path\to\sas.log' ;

data times ;
  infile saslog scanover ;
  format elapsed 
         cpu_time time20.2 
         ;
  input @'real time' elapsed  :hhmmss20.
        @'cpu time'  cpu_time :hhmmss20.
        @
        ;
  output ;
run ;

title 'SAS LOG analysis' ;
proc report data = times nowd ;
  column n
         elapsed
         cpu_time
         ;
  define n        /           'Step Count'         ;
  define elapsed  / group sum 'Total Elapsed Time' ;
  define cpu_time / group sum 'Total CPU Time'     ;
run ;
title ;
Author:
Alan D Rudland
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags