11-28-2013 07:50 AM
is it any easy way to look for specifik words in text files?
in a cataloge i have 100 files and i want to find all files that contain the word: "ERROR:" and print the file name.
11-29-2013 01:24 PM
The following SAS code, which will only work on the Windows OS, will search in the &let dir directory for all text files for the words specified in the &let SearchString= statement. The names of the resulting files are stored in the variable filename in dataset work.Filenames:
filename pipedir pipe "FINDSTR /M /D:&dir ""&SearchString"" *.txt" lrecl=32767;
infile pipedir truncover;
input filename $char1000.;
if _n_ eq 1 then delete;
11-29-2013 07:44 PM
As it sounds you want to analyse SAS logs below 2 links might be of interest for you:
The first link is pure SAS code. It's not scanning the log files for Warnings or Errors but the techniques used there can also be applied for these keywords.
Be aware that Error messages can span over more than one line so what Tom suggests would need some amendment in order to capture all lines and not only the first one with ERROR: in it.