Hey, Tarik! How about trying something like this:
/* Set up a filreref pointing to the log file */
filename readme "&filepath/sample_log.txt";
DATA _NULL_;
/* If an error is never found, we don't want anything to happen */
/* ErrorFound is a flag to remember if one has been found or not*/
retain ErrorFound 0;
infile readme;
input;
if find(_infile_,"ERROR") then do;
/* There is an ERROR message startinin this line of the log */
if not ErrorFound then do;
/* This is the first ERROR found, so set up the email */
FILE MYMAIL
TO="tarik.birinci@ozu.edu.tr"
SUBJECT="%upcase(&SYSHOSTNAME) INFO"
;
PUT " Hello";
end;
/* remember we've already found an ERROR */
ErrorFound=1;
/* Write the current LOG file line to the EMAIL file */
put _infile_;
end;
RUN;
filename mymail;
filename Readme;
May the SAS be with you! Mark
... View more