Date: Tue, 13 Oct 2009 16:18:27 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Determining if a character string includes a phrase
In-Reply-To: <FEE685C811A7E44AAD17E47B2A966E29BAD42C31BD@KITE.wharton.upenn.edu>
Content-Type: text/plain; charset=ISO-8859-1
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'. -. generates
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.
.
-Joe
On Tue, Oct 13, 2009 at 3:44 PM, Keintz, H. Mark
<mkeintz@wharton.upenn.edu>wrote:
> 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 the
> 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 would
> 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 a
> power, where the "power" was the EBCDIC code for blank, _, A, B,...,Z. Of
> course mathematically -0 to any power should evaluate to +0. And SAS
> apparently preserved this outcome for ., but seemed to have overlooked the
> other missing values.
>
> Cute?. OK, it's cute.
>
>
> Regards,
> Mark
>
|