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!
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;
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.
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.
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!
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 16. Read more here about why you should contribute and what is in it for you!
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.