BookmarkSubscribeRSS Feed
whijazi
Calcite | Level 5

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!

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

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;

Astounding
Opal | Level 21

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.

whijazi
Calcite | Level 5

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.

kaji
Fluorite | Level 6

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!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 967 views
  • 2 likes
  • 4 in conversation