From: Paige Miller on
When I want to search for ERRORs in my SASLOG, I can of course do a
search for the test string ERROR in the SASLOG, however sometimes this
turns up _ERROR_, which really isn't an error, it is written to the
LOG by a data step (for example, if you divide by zero). In this
instance, and many similar instances, I'm not really interested in
finding _ERROR_, but there could be a bazillion of them.

So, next, trying to find actual code ERRORs, I search for
'ERROR:' (without the quotes, but with that colon on the end) which
helps me find normal code errors, but I also have to search for "ERROR
' (without the quotes, but with a space after the last R), which helps
me find MACRO errors.

Is there a better way to find ERRORs in the SASLOG, skipping the data
step _ERROR_, and finding both MACRO errors and normal code errors?
From: Lou on
"Paige Miller" <paige.miller(a)kodak.com> wrote in message
news:0447a200-788d-44eb-9bb6-a9a271dc8f5b(a)c16g2000yqd.googlegroups.com...
> When I want to search for ERRORs in my SASLOG, I can of course do a
> search for the test string ERROR in the SASLOG, however sometimes this
> turns up _ERROR_, which really isn't an error, it is written to the
> LOG by a data step (for example, if you divide by zero). In this
> instance, and many similar instances, I'm not really interested in
> finding _ERROR_, but there could be a bazillion of them.
>
> So, next, trying to find actual code ERRORs, I search for
> 'ERROR:' (without the quotes, but with that colon on the end) which
> helps me find normal code errors, but I also have to search for "ERROR
> ' (without the quotes, but with a space after the last R), which helps
> me find MACRO errors.
>
> Is there a better way to find ERRORs in the SASLOG, skipping the data
> step _ERROR_, and finding both MACRO errors and normal code errors?

Yeah - don't make _ERROR_'s in the first place. In my business, if a log
shows those kinds of messages, the program is not finished. Tighten up your
code - for example,

if y ^= 0 then z = x / y;

will mean that you don't get _ERROR_ messages due to attempted division by
zero

If that's really too much trouble, you could use additional operands of the
find command. For instance

find ERROR word

will find the words "ERROR" and "ERROR:" but not find the word "_ERROR_".


From: Tom Abernathy on
Speaking of regular expressions I use the following when searching for
errors in SAS log files on unix:

grep '^ERROR.*:'

So that only ERROR message that start in column 1 and also have a semi-
colon will be found.
In a SAS data step I would code this as:
if _infile_=:'ERROR' and index(_infile_,':') then ....


On Mar 18, 12:56 pm, "Lou" <lpog...(a)hotmail.com> wrote:
> "Paige Miller" <paige.mil...(a)kodak.com> wrote in message
>
> news:0447a200-788d-44eb-9bb6-a9a271dc8f5b(a)c16g2000yqd.googlegroups.com...
>
> > When I want to search for ERRORs in my SASLOG, I can of course do a
> > search for the test string ERROR in the SASLOG, however sometimes this
> > turns up _ERROR_, which really isn't an error, it is written to the
> > LOG by a data step (for example, if you divide by zero). In this
> > instance, and many similar instances, I'm not really interested in
> > finding _ERROR_, but there could be a bazillion of them.
>
> > So, next, trying to find actual code ERRORs, I  search for
> > 'ERROR:' (without the quotes, but with that colon on the end) which
> > helps me find normal code errors, but I also have to search for "ERROR
> > ' (without the quotes, but with a space after the last R), which helps
> > me find MACRO errors.
>
> > Is there a better way to find ERRORs in the SASLOG, skipping the data
> > step _ERROR_, and finding both MACRO errors and normal code errors?
>
> Yeah - don't make _ERROR_'s in the first place.  In my business, if a log
> shows those kinds of messages, the program is not finished.  Tighten up your
> code - for example,
>
> if y ^= 0 then z = x / y;
>
> will mean that you don't get _ERROR_ messages due to attempted division by
> zero
>
> If that's really too much trouble, you could use additional operands of the
> find command.  For instance
>
> find ERROR word
>
> will find the words "ERROR" and "ERROR:" but not find the word "_ERROR_".

From: xiaobin on
Try the %checklog. It only identifies the ERRORs you are interested.
However, I agree with Lou that any type of error should be treated
with caution.
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0411E&L=sas-l&P=16645
From: Patrick on
In SAS EG or PC SAS (9.2, not sure for previous) "find" using a
regular expression is possible. This RegEx should to the job:
^ERROR[: ]
I believe the same expression could also be used under Unix with
"egrep".