LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Nov 2000 18:32:31 -0800
Reply-To:     kmself@IX.NETCOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         kmself@IX.NETCOM.COM
Subject:      Re: funny behavior
In-Reply-To:  <>; from
              pete.lund@HOME.COM on Fri, Nov 10, 2000 at 01:40:31AM +0000
Content-Type: multipart/signed; micalg=pgp-sha1;

on Fri, Nov 10, 2000 at 01:40:31AM +0000, Pete Lund (pete.lund@HOME.COM) wrote: > JP- > What you're really saying in your x1=x2=x3=x4=0 is: > x1 = (x2=x3=x4=0) > where "x2=x3=x4=0" is a logical expression that will return false (0). > The expression is basically asking "are x2, x3, x4 and 0 all the > same?" At this point, since x2-x4 have never been referenced, they > are not 0 and so the expression is false.

Pete's explanation is probably clearer if we specify the equivalence operator rather than the '=' sign, whose interpretation is overloaded in SAS:

x= expression;

...assigns to X the value of 'expression'.

y= ( x = epression );

...assigns to Y the value of 'X eq expression'.

For clarity, I prefer to write:

y = ( x eq expression );

Pete's illustration then becomes:

x1 = ( x2 eq x3 eq x4 eq 0 );

I for one would prefer that this distinction could be made an error test in code -- use of '=' as an equality test rather than as an assignment would produce an error condition. Much sloppy code exists which assumes the incorrect behavior.

-- Karsten M. Self <> Evangelist, Zelerate, Inc. What part of "Gestalt" don't you understand? There is no K5 cabal


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