LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 12 Jul 2002 09:56:24 -0400
Reply-To:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:   Re: automated log-checking
Comments:   To: Quentin McMullen <QuentinMcMullen@WESTAT.com>
Content-Type:   text/plain; charset="iso-8859-1"

Quentin,

There is a bug in the way the ERROR command works. It's chief advantage is that the dump is limited by the option ERRORS. However, if you add an appropriate error message then that message will not be controlled by the option ERRORS.

IanWhitlock@westat.com

-----Original Message----- From: Quentin McMullen Sent: Friday, July 12, 2002 9:46 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: automated log-checking

Hi All,

Thanks to many for their thoughts so far.

One issue I hadn't really considered was how log-checking should detect user-generated error messages.

For example, in a private reply Marianne Whitlock said she uses the error statement to catch problematic situations, e.g.:

215 data a (keep=x); 216 do i=1 to 10; 217 x=ranuni(10); 218 output; 219 end; 220 run;

NOTE: The data set WORK.A has 10 observations and 1 variables. NOTE: DATA statement used: real time 0.00 seconds

221 222 data b; 223 set a; 224 if x<.5 then error; 225 run;

x=0.2160257787 _ERROR_=1 _N_=5

x=0.4297917315 _ERROR_=1 _N_=7

x=0.3169172282 _ERROR_=1 _N_=8

x=0.4979402621 _ERROR_=1 _N_=9 NOTE: There were 10 observations read from the data set WORK.A.

Another alternative is to manually set the error flag (if x<.5 then _error_=1). In both of these situations, the user has defined an error condition, and SAS reports the presence of it by dumping a line to the log. It does not, however, add a SAS ERROR: message, or even a NOTE:. Thus an automated log-checker looking for NOTE:, ERROR:, or WARNING: would miss this problem. Does it seem reasonable to ask SAS to add a NOTE: (or even WARNING:) whenever _error_ is true (whether it has been set manually or automatically)?

Without that, the alternative is to impose the user requirement that all user-generated error messages have the same form as SAS-generated messages, e.g.

241 data b; 242 set a; 243 if x<.5 then error "ER" "ROR: x<.5"; 244 run;

ERROR: x<.5 x=0.2160257787 _ERROR_=1 _N_=5 ERROR: x<.5 x=0.4297917315 _ERROR_=1 _N_=7 ERROR: x<.5 x=0.3169172282 _ERROR_=1 _N_=8 ERROR: x<.5 x=0.4979402621 _ERROR_=1 _N_=9 NOTE: There were 10 observations read from the data set WORK.A.

[ As a side issue, it is unclear to me *when* SAS checks the value of _error_. I had thought it was at the bottom of the implied data step loop, but the below puts a single note to the log, even though it never reaches the bottom. Any thoughts?

226 data _null_; 227 do until (eof); 228 set a end=eof; 229 if x<.5 then _error_=1; 230 end; 231 stop; 232 run;

eof=1 x=0.665665516 _ERROR_=1 _N_=1 NOTE: There were 10 observations read from the data set WORK.A. ]

Kind Regards, --Quentin


Back to: Top of message | Previous page | Main SAS-L page