BookmarkSubscribeRSS Feed
Karthik22
Calcite | Level 5
Hello All,
I have few sas program, it's log file in .txt format which is located in a folder. I need to read all the log files and find the error messages. Please suggest me the code to do this.
1 REPLY 1
Ksharp
Super User
%let path= D:\test\SASLOG ;    /*the path of LOG file*/


filename x pipe "dir &path.\*.log /s /b";
data check_log;
infile x length=len;
input fvar $varying200. len;

length filename fname $ 200;
infile dummy filevar=fvar filename=fname end=last length=len;
do while(not last);
 input log $varying400. len;
 if upcase(log) in: ('ERROR' 'WARNING') then do;filename=fname;output;end;
end;
run;

proc print noobs;run;

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!

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
  • 423 views
  • 1 like
  • 2 in conversation