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 (December 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 18 Dec 2000 12:53:11 -0500
Reply-To:     Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:      Re: Division by missing (Zero).

On Mon, 18 Dec 2000 12:11:05 -0500, Howard Schreier

Little addon: if you really want the system to provide the error message and produce the missing values, you should set the option ERRORS= to a high value. After the number of errors SAS should ignore, normally an abend happens! I'd prefer to make it explicite, something like:

if div=. then do; res=.; put "missing value for DIV..."; end; else do; res=x/div; end;

In this way you can deal with all kind of errors and the program always continues.

<Howard_Schreier@ITA.DOC.GOV> wrote:

>The normal behavior of SAS is precisely what is requested in the original >posting. > >When a divisor is missing, SAS skips the calculation, records a missing >value for the result, and places a summary note in the log. It does not halt >(at least not under usual system options settings). > >This is called propagation of missing values, and applies to expression >evaluation in general (not just to division). > >Division by zero (which is not illustrated in the sample data) is >different. It makes a bigger mess in the log, but it does not stop execution >either. > >On Fri, 15 Dec 2000 17:09:03 -0800, kmself@IX.NETCOM.COM wrote: > >>on Fri, Dec 15, 2000 at 12:34:49PM -0800, Anna Henson >(anna_henson@YAHOO.COM) wrote: >>> Shiferaw_G wrote in message >>> <038930B7F7AFD411AD8000508BCDEDAE0D52C8@PSBMAIL5>... >>> >I have a data set as follow: >>> > >>> >Data T1; >>> >Input C D E; >>> > >>> >Av_CD= C/D; >>> >Av_DE=D/E; >>> > >>> >When one of the variables is missing I get division by zero and the >whole >>> >process is stopped. I want the process to continue with calculating the >>> >Average of those variables which values and skip or flag those with >missing >>> >values. Is it possible to do that with SAS? >>> > >>> >Cards; >>> > >>> >1 3 4 >>> >3 . 4 >>> >. 5 . >>> > >>> >; >>> > >> >>> Hi This is what I got from SAS website for division by Zero >>> >>> >>> >>> Just replace x/y with x/(y+(y=0)) - x*(y=0) >>> >>> I tried it, and it worked great. >> >> >>At least two problems: >> >> 1. What is the intended result where no calculation is performed -- >> is it zero, missing, some other assigned value, or a special flag? >> This logic doesn't provide for this. >> >> 2. The logic doesn't allow for missing values. I believe a test for >> >> ( abs( y ) gt 0 ) >> >> would be an improvement. SI's example site should correct this. >> >>Note also: I prefer the lt, gt, and eq operators for platform >>portability and lack of confusion with the SAS assignment operator '='. >>Token overloading is a Bad Thing [tm], particularly for very frequently >>used tokens whose alternative uses may be easily confused. >> >>As they say in Humboldt County, "Don't overload your tokin', dude". >> >>-- >>Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/ >> Evangelist, Zelerate, Inc. http://www.zelerate.org >> What part of "Gestalt" don't you understand? There is no K5 cabal >> http://gestalt-system.sourceforge.net/ http://www.kuro5hin.org >>


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