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 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
=========================================================================
Date:         Thu, 18 Jul 2002 17:46:25 -0400
Reply-To:     Jim <jlinck@UGA.EDU.NOSPAM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim <jlinck@UGA.EDU.NOSPAM>
Organization: University of Georgia
Subject:      Re: Division by Zero/Missing Value Errors

Maybe I misread your note, but are you suggesting that since some users might use it incorrectly, then we should not offer it? I disagree with this line of reasoning completely. If we took this to its logical conclusion, then we wouldn't have SAS at all.

Having a simple global switch that users could turn on to ignore division by zero errors only is a great idea that SAS should consider including in their product (i.e., work like nonotes, etc.). Sure, one can get around this error with lots of code, but that's true with just about anything. Might as well make it easier (more useful, more productive).

My 2 cents.

Jim

"Don Henderson" <donaldjhenderson@HOTMAIL.COM> wrote in message news:OE138IKy2b54OJZpwoj000044a7@hotmail.com... > I, for one, would hope that such an option is not provided in SAS. It is > simple enough to write code so as to avoid such messages. In fact, I make it > a policy that any code I use on a regular basis has no warning messages, > etc. That way I know that when such a note appears, it is a new one and it > is surfacing something I need to be aware of. > > Think of all the problems that users could get into by turning on such an > option because they have, say, XX fields that could be zero that they need > to divide by. They turn on this option, only to have it suppress other > messages that they do want or need to see. Since they don't see the notes, > they could dig a very deep hole for themselves. > > Next, think about the "scope" for such an option? Front that point forward > in the SAS job? Or just the given data step? Or just the following > statements? > > I could envision that perhaps some sort of block structure might be doable, > e.g., something like: > > NoDivideByZero Begin; > x = z/y; > a = b/c; > NoDivideByZero End; > > But frankly, there are too many other things that would be far higher on my > priority list for the developers at SAS. > > Just my 2 cents. > > -don henderson > > ----- Original Message ----- > From: "Kevin Myers" <KevinMyers@AUSTIN.RR.COM> > Newsgroups: bit.listserv.sas-l > To: <SAS-L@LISTSERV.UGA.EDU> > Sent: Thursday, July 18, 2002 5:11 PM > Subject: Re: Division by Zero/Missing Value Errors > > > > I've had the same needs that Jim discusses here on many occasions, and for > > similar reasons, and I'll bet lots of other folks out there have too. We > > ought to make a suggestion along these lines for the SASware ballot. My > > $.02 worth. > > > > Kevin A. Myers > > Myers Engineering > > Round Rock, Texas > > > > > > ----- Original Message ----- > > From: "Jim" <jlinck@UGA.EDU.NOSPAM> > > Newsgroups: bit.listserv.sas-l > > To: <SAS-L@LISTSERV.UGA.EDU> > > Sent: Thursday, July 18, 2002 3:51 PM > > Subject: Re: Division by Zero/Missing Value Errors > > > > > > > Yes, the macro is the solution I am using (offered by another user > > > off-line). I was really hoping there was a "switch" in SAS that would > > allow > > > one to turn this type of error off (w/o ignoring all error reporting). > > > Thanks, > > > Jim > > > > > > "Dale McLerran" <stringplayer_2@YAHOO.COM> wrote in message > > > news:20020718200640.49383.qmail@web21101.mail.yahoo.com... > > > > Jim, > > > > > > > > I am certain that Shiling Zang was arguing against setting _error_=0. > > > > Only marginally different would be to set OPTIONS ERRORS=0. I > > > > believe that you do have to code the syntax which checks for valid > > > > denominator before executing the division. If you have a lot of > > > > strict assignment statements which should be checked for valid > > > > denominator, then you could write a macro to subtitute the appropriate > > > > code so that you don't have to do the tedium. That is, if you have > > > > statements like > > > > > > > > z = y / x; > > > > > > > > then the macro > > > > > > > > %macro divide(result,num,denom); > > > > if &denom>.Z & &denom^=0 then &result = &num/&denom; > > > > %mend; > > > > > > > > would reduce your coding effort. Within a datastep, all you would > > > > need do is invoke the macro as shown below: > > > > > > > > %divide(z,y,x) > > > > > > > > > > > > This is only marginally more expensive in terms of your coding > > > > effort than coding z=y/x. Note that macro variables NUM and DENOM > > > > could be functions. There might be some macro quoting which is > > > > required to avoid errors for some functions. Other than this, I > > > > don't believe that there is anything you can do to ensure not getting > > > > division by zero/missing errors. > > > > > > > > Dale > > > > > > > > > > > > --- Jim <jlinck@UGA.EDU.NOSPAM> wrote: > > > > > I don't like that solution. I don't want errors=0 set because I > only > > > > > want > > > > > to stop this particular kind of error. And actually the code to > stop > > > > > it is > > > > > slightly more complicated that the code you wrote (due to missing > > > > > values), > > > > > and it is this code I am trying to avoid. > > > > > Thanks, > > > > > Jim > > > > > "shiling zhang" <shiling99@yahoo.com> wrote in message > > > > > news:feab3d5d.0207181105.64f960d1@posting.google.com... > > > > > > Though you can set _error_=0 to maneuver it, I still think it > > > > > should > > > > > aviod. > > > > > > Especially, when you have a great deal of calculation volume, it > is > > > > > a good > > > > > > to use > > > > > > > > > > > > if xyz ne 0 then zyx=1/xyz; > > > > > > > > > > > > See the log file below. > > > > > > > > > > > > **************************************** > > > > > > 7020 data t1; > > > > > > 7021 do i=1 to 1e7; > > > > > > 7022 x=mod(i,3); > > > > > > 7023 output; > > > > > > 7024 end; > > > > > > 7025 run; > > > > > > > > > > > > NOTE: The data set WORK.T1 has 10000000 observations and 2 > > > > > variables. > > > > > > NOTE: DATA statement used: > > > > > > real time 17.56 seconds > > > > > > cpu time 17.11 seconds > > > > > > > > > > > > > > > > > > 7026 > > > > > > 7027 data _null_; > > > > > > 7028 set t1; > > > > > > 7029 y=i/x; > > > > > > 7030 run; > > > > > > > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=3 x=0 y=. _ERROR_=1 _N_=3 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=6 x=0 y=. _ERROR_=1 _N_=6 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=9 x=0 y=. _ERROR_=1 _N_=9 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=12 x=0 y=. _ERROR_=1 _N_=12 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=15 x=0 y=. _ERROR_=1 _N_=15 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=18 x=0 y=. _ERROR_=1 _N_=18 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=21 x=0 y=. _ERROR_=1 _N_=21 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=24 x=0 y=. _ERROR_=1 _N_=24 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=27 x=0 y=. _ERROR_=1 _N_=27 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=30 x=0 y=. _ERROR_=1 _N_=30 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=33 x=0 y=. _ERROR_=1 _N_=33 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=36 x=0 y=. _ERROR_=1 _N_=36 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=39 x=0 y=. _ERROR_=1 _N_=39 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=42 x=0 y=. _ERROR_=1 _N_=42 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=45 x=0 y=. _ERROR_=1 _N_=45 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=48 x=0 y=. _ERROR_=1 _N_=48 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=51 x=0 y=. _ERROR_=1 _N_=51 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=54 x=0 y=. _ERROR_=1 _N_=54 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > i=57 x=0 y=. _ERROR_=1 _N_=57 > > > > > > NOTE: Division by zero detected at line 7029 column 7. > > > > > > ERROR: Limit set by ERRORS= option reached. Further errors of > this > > > > > type > > > > > > will not be printed. > > > > > > i=60 x=0 y=. _ERROR_=1 _N_=60 > > > > > > NOTE: Mathematical operations could not be performed at the > > > > > following > > > > > > places. The results of the operations have been set to missing > > > > > values. > > > > > > Each place is given by: (Number of times) at > (Line):(Column). > > > > > > 3333333 at 7029:7 > > > > > > NOTE: There were 10000000 observations read from the data set > > > > > WORK.T1. > > > > > > NOTE: DATA statement used: > > > > > > real time 1:52.94 > > > > > > cpu time 1:49.28 > > > > > > > > > > > > > > > > > > 7031 > > > > > > 7032 data _null_; > > > > > > 7033 set t1; > > > > > > 7034 y=i/x; > > > > > > 7035 _error_=0; > > > > > > 7036 run; > > > > > > > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Over 100 NOTES, additional NOTES suppressed. > > > > > > NOTE: Division by zero detected at line 7034 column 7. > > > > > > NOTE: Mathematical operations could not be performed at the > > > > > following > > > > > > places. The results of the operations have been set to missing > > > > > values. > > > > > > Each place is given by: (Number of times) at > (Line):(Column). > > > > > > 3333333 at 7034:7 > > > > > > NOTE: There were 10000000 observations read from the data set > > > > > WORK.T1. > > > > > > NOTE: DATA statement used: > > > > > > real time 1:46.06 > > > > > > cpu time 1:44.59 > > > > > > > > > > > > > > > > > > 7037 > > > > > > 7038 data _null_; > > > > > > 7039 set t1; > > > > > > 7040 if x ne 0 then y=i/x; > > > > > > 7041 run; > > > > > > > > > > > > NOTE: There were 10000000 observations read from the data set > > > > > WORK.T1. > > > > > > NOTE: DATA statement used: > > > > > > real time 14.50 seconds > > > > > > cpu time 14.27 seconds > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Jim" <jlinck@uga.edu.nospam> > > > > > > Newsgroups: comp.soft-sys.sas > > > > > > Sent: Thursday, July 18, 2002 2:04 PM > > > > > > Subject: Division by Zero/Missing Value Errors > > > > > > > > > > > > > > > > > > > I often have a great deal of division by missing value/zero > > > > > errors in my > > > > > > SAS > > > > > > > log. Since I often search my log for the word "error" while I > am > > > > > > debugging > > > > > > > programs, this is a pain. What I end up doing is writing lots > of > > > > > if > > > > > > > statements (if denominator=0, then don't do the calc), etc. I > > > > > was > > > > > > wondering > > > > > > > if there is an option to turn of this specific type of error > from > > > > > > reporting > > > > > > > within SAS. Thanks, > > > > > > > Jim > > > > > > > > > > > > > > > > > > > > > > > > > > ===== > > > > --------------------------------------- > > > > Dale McLerran > > > > Fred Hutchinson Cancer Research Center > > > > mailto: dmclerra@fhcrc.org > > > > Ph: (206) 667-2926 > > > > Fax: (206) 667-5977 > > > > --------------------------------------- > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! Autos - Get free new car price quotes > > > > http://autos.yahoo.com


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