LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Sep 2003 12:11:25 -0700
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: if(), while (), until() - short circuit evaulation ?
Comments: To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>

And order the conditions by least-likelihood:

if State='RI' then if State='NY' then ...

Paul Choate DDS Data Extraction (916) 654-2160

This isn't right, this isn't even wrong -- Wolfgang Pauli

-----Original Message----- From: Fehd, Ronald J. (PHPPO) [mailto:rjf2@CDC.GOV] Sent: Tuesday, September 30, 2003 11:03 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: if(), while (), until() - short circuit evaulation ?

> From: Richard A. DeVenezia [mailto:radevenz@IX.NETCOM.COM] > In DATA Step, does the while () clause (or I suppose eval in > generation ... > if() until(), etc...) use short circuit testing ? > > i.e. > A=1 > B=2 > > if (A=1 or B=2) then ... else ... > if short-circuit evaluation then the then clause should run > without having to test B=2 > > if (A=0 and B=2) then ... else ... > if short-circuit evaluation then the else clause should run > without having to test B=2

I'm not sure, probably need a Little Birdy to comment on that.

however, one of the optimizing tricks in SAS Programming Tips: A Guide to Efficient SAS Processing is to replace if A=1 and B=2 then with if A=1 then if B=2 then ...

you are highly discouraged from using else with this construction as will be immediately evident upon careful thought. %-|

Ron Fehd the logical maven CDC Atlanta GA USA RJF2@cdc.gov

By using your intelligence you can sometimes make your problems twice as complicated. -- Ashleigh Brilliant

If you always try to be logical, you probably won't ever have much sorrow, or much fun. -- Ashleigh Brilliant pot-shot #4438


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