LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2012, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Feb 2012 09:35:51 -0500
Reply-To:   Rick Wicklin <Rick.Wicklin@SAS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Rick Wicklin <Rick.Wicklin@SAS.COM>
Subject:   Re: Double inequality and macros
Comments:   To: Talbot Michael Katz <topkatz@MSN.COM>

The "double inequality" is sometimes called an "implicit AND" operation. It is a particular feature of the DATA step language and does not apply generally to all SAS languages. I am not a macro expert (or Maven), but I looked at the MACRO evaluation doc (http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/vi ewer.htm#p18bcfyqilvhc3n12stuo8eafd46.htm, or short url http://bit.ly/xF98Dh) and didn't see it mentioned.

I do know that the implicit AND operation is not part of the SAS/IML language, nor is it in PROC SQL, although SQL has the BETWEEN/AND operator. The implicit AND is also not part of C, C++, R, MATLAB, or any other language that I routinely use, although I believe it is valid in Perl 6 (but not Perl 5) and Python.

Your statement %if 1 < &parm. le 100 %then %do ; is always TRUE because it is evaluated from left to right as %if ( (1 < &parm.) le 100) %then %do ; Because the first expression is always 0 or 1 (regardless of &param), and because 0 and 1 are both LE 100, the expression is constantly TRUE.

Rick Wicklin Statistical programming and SAS/IML blog: http://blogs.sas.com/content/iml


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