Date: Fri, 1 Dec 2006 10:21:50 -0500
Reply-To: "Wainwright, Andrea" <andrea.wainwright@CAPITALONE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Wainwright, Andrea" <andrea.wainwright@CAPITALONE.COM>
Subject: Re: Evaluating an IF/THEN in the negative?
Content-Type: text/plain; charset="us-ascii"
In the first example you needed AND.
IF (MISSING(VAR1) = 0 AND VAR1 NE 0)
Says if it isn't missing AND it isn't 0.
When negating you need and not or. (A AND B)=NOT(NOT A OR NOT B)
A B A and B not A not B not A or not B not(not A or not B)
T T T F F F T
T F F F T T F
F T F T F T F
F F F T T T F
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Thursday, November 30, 2006 10:35 PM
Subject: Evaluating an IF/THEN in the negative?
I came across an interesting "issue" last week and was wondering why it
worked one way but not the other.
Here's a bit 'o the code:
IF (MISSING(VAR1) = 0 OR VAR1 NE 0) THEN RESULT1 = ABC/VAR1; ELSE
RESULT1 = 999999999999999;
The evaluation worked correctly for the MISSING part but not for the
VAR1 NE 0. However, I adjusted the code to
IF (MISSING(VAR1) OR VAR1 = 0) THEN RESULT1 = 999999999999999; ELSE
RESULT1 = ABC/VAR1;
and everything thing worked wonderfully every time in both situations.
The information contained in this e-mail is confidential and/or proprietary
to Capital One and/or its affiliates. The information transmitted herewith
is intended only for use by the individual or entity to which it is
addressed. If the reader of this message is not the intended recipient,
you are hereby notified that any review, retransmission, dissemination,
distribution, copying or other use of, or taking of any action in reliance
upon this information is strictly prohibited. If you have received this
communication in error, please contact the sender and delete the material
from your computer.