Date: Tue, 13 Oct 2009 19:37:46 -0400
Reply-To: Paul Dorfman <sashole@BELLSOUTH.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Dorfman <sashole@BELLSOUTH.NET>
Subject: Re: Determining if a character string includes a phrase
OK, Mark Keintz and you have nailed it. If X is *a* missing value, X = -X
only if X contains a standard null (. , aka dot-blank), and X ne -X
if X contains a special null. The side effect is the "missing values have
been generated" log note, stemming from the implicit multiplication of
missing X by -1.
Thus, a full test for a special missing value is
X ne --X
because this expression is true if and only if X is a special null. The
practicality of such a test is pretty much limited by the "cuteness" of
recognizing how SAS treats missing values in arithmetic operations. Since I
strongly dislike any avoidable log notes, my test for a special missing
value in the real life would rather be
nmiss (X) and X ne .
On Tue, 13 Oct 2009 16:18:27 -0500, Joe Matise <snoopy369@GMAIL.COM> wrote:
>Actually, SAS does treat all nonordinary missing values the same as it
>treats ordinary missing values. Therein lies the problem.
>-.A = .
>-.B = .
>-. = .
>But that is not to say that 'negative missing equals missing'. -.
>a missing value in the same way that -1**0.5 generates a missing value. -.
>is an illegal operation, same as -.A, -.B, etc., and generates the
>appropriate log entries.
>On Tue, Oct 13, 2009 at 3:44 PM, Keintz, H. Mark
>> Paul D said:
>> > I call it "Boolean normalizing operator" because it turns any true
>> > value
>> > (i.e. anything not zero and not missing) to 1 and any false value (i.e.
>> > anything zero or missing) to 0. As _Null_ pointer out, same as mnemonic
>> > NOT
>> > NOT. Hence the following, where X is a numeric expression,
>> > bool = ^^ X ;
>> > bool = not not X ;
>> > are fully equivalent to
>> > if X = 0 or missing (X) then bool = 0 ;
>> > else bool = 1 ;
>> > or
>> > if X then bool = 1 ; else bool = 0 ;
>> > Another clever trick from the same bag is
>> > bool = X = -X ;
>> > It comes with a slight marring side effect. I will leave it to SAS-L to
>> > ponder which condition it tests for and what the side effect is. When,
>> > a
>> > long time ago, I showed it to Bob Virgile (renowned for his deep
>> > appreciatiion of such SAS artifacts) he called it "cute".
>> OK Paul, I pondered. Until you instigated the doubt, I had assumed "bool
>> X = -X" was equivalent to a test for X=0. I see that is almost always
>> right interpretation.
>> ... Almost. While SAS asserts (as I expected)
>> ._ ^= -._
>> .A ^= -.A
>> .Z ^= -.Z
>> but SAS also says
>> . = -.
>> Too bad. If SAS treated all missing values the way it treats ordinary .,
>> then we'd have a short expression for (x=0 or missing(x)=1). Or if SAS
>> treated . the way it treats all other missing values, then at least it
>> be consistent, though less fun.
>> Back in the SAS on IBM mainframe only days, I attended a SAS presentation
>> by Jim Barr, who told us (IIRC) that missing values were stored as -0 to
>> power, where the "power" was the EBCDIC code for blank, _, A, B,...,Z.
>> course mathematically -0 to any power should evaluate to +0. And SAS
>> apparently preserved this outcome for ., but seemed to have overlooked
>> other missing values.
>> Cute?. OK, it's cute.