I wrote a SAS program that outputs the SAS log to a specific folder via PROC PRINTTO. In addition, I used the INDEX function to search the log file for the string "ERROR:" . In case of an error, the INDEX function (using variable X) will be GT 1, thus activating a macro statement - sending an Email that an error occurred. I wish to find a function that looks for the string "ERROR:" but retrieves the whole sentence.