Date: Fri, 1 Dec 2006 15:39:10 +0000 toby dunn "SAS(r) Discussion" toby dunn Re: Evaluating an IF/THEN in the negative? To: paulasims2004@hotmail.com text/plain; format=flowed

Paula ,

I see you have gotten plenty of solutions so far, confused as all get out yet????

Okay let me make this as simple as possible the code you are using just needs to be made simplier, remember simplier ussually means better.

If your goal is to prevent the division when Var1 is either 0 or missing then,

If ( VAR1 Not In ( . 0 ) ) Then Result1 = ABC / VAR1 ; Else Result1 = 999999999999999 ;

Or

If ( VAR1 > 0 ) ) Then Result1 = ABC / VAR1 ; Else Result1 = 999999999999999 ;

Toby Dunn

Quickly, bring me a beaker of wine, so that I may wet my mind and say something clever. Aristophanes

Wise people, even though all laws were abolished, would still lead the same life. Aristophanes

You should not decide until you have heard what both have to say. Aristophanes

From: Paula Sims <paulasims2004@HOTMAIL.COM> Reply-To: Paula Sims <paulasims2004@HOTMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Evaluating an IF/THEN in the negative? Date: Fri, 1 Dec 2006 03:34:35 GMT

Hi everyone, 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. Why???

Thanks

Paula

_________________________________________________________________ MSN Shopping has everything on your holiday list. Get expert picks by style, age, and price. Try it! http://shopping.msn.com/content/shp/?ctId=8000,ptnrid=176,ptnrdata=200601&tcode=wlmtagline

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