Help using Base SAS procedures

Automate the Checking of a SAS Log File

Reply
Occasional Contributor
Posts: 12

Automate the Checking of a SAS Log File

Hello All,

I would like to review a set of Log files produced. I would like to automate the process by running some sort of SAS code that would comb through the log files and returns all lines containing errors and warnings for my review. any ideas? 

thank you!

PROC Star
Posts: 1,564

Re: Automate the Checking of a SAS Log File

Many ways to skin that particular cat depending on what you're after.

Here's an example I wrote once to seek steps with run times higher that 4 seconds.

You log analysis program will look very similar. Just modify to suit your needs.

 

data _null_;

  if LASTREC then put MAXTIME= /;

  retain N MAXTIME;

  infile 'file.log'

         pad truncover end=LASTREC;

  input X $250.;

  X1=lag1(X);

  X2=lag2(X);

  X3=lag3(X);

  X4=lag4(X);

  X5=lag5(X);

  X6=lag6(X);

  X7=lag7(X);

  X8=lag8(X);

  X9=lag9(X);

  if X=:'real time' then TIME=input(scan(X,3,' '),stimer.);

  if TIME>4 or N;

  if N=. then put / '==============' / / X9 / X8 / X7 / X6 / X5 / X4 / X3 / X2 / X1;

  if TIME>4 then do;

    N=_N_;

    MAXTIME=max(TIME,MAXTIME);

  end;

  if _N_ < N+9 then put  X;

  else N=.;

run;

Super User
Posts: 5,093

Re: Automate the Checking of a SAS Log File

Is there any reason it has to be a SAS program?  Depending on the operating system, there may be system commands already built to do what you are asking for.  So that's question #1, what is your operating system.

Suggestion:  Don't limit your search to errors and warnings.  Some notes may be important:  uninitialized variables, type conversions, many-to-many merges to name a few.

Good luck.

Occasional Contributor
Posts: 12

Re: Automate the Checking of a SAS Log File

Hey Astounding,

it doesnt have to be, but it is more convinient I guess, Since the code is part of a monthly run. I appreciate your suggestion regarding the extra notes. Ill make sure to include those as well.

Occasional Contributor
Posts: 13

Re: Automate the Checking of a SAS Log File

Hi,

 

I found a pretty cool add-in to Base SAS on www.tatesoft.com that may be very usefull to you. The tool called Log Analyser is integrated into Base SAS and can produce Log summary report in a second. You may also analyse log in details if you wish. Really great tool!

Ask a Question
Discussion stats
  • 4 replies
  • 299 views
  • 2 likes
  • 4 in conversation