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: <vtjm0tst0n3eb5dv3c1hnn809vfbipl6bi@4ax.com>; from
pete.lund@HOME.COM on Fri, Nov 10, 2000 at 01:40:31AM +0000
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature";
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 <kmself@ix.netcom.com> http://www.netcom.com/~kmself
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
[application/pgp-signature]