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 (January 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 8 Jan 1999 08:12:39 EST
Reply-To:   Karl Gerber <KarlGerber@AOL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Karl Gerber <KarlGerber@AOL.COM>
Subject:   Logical operators in macro
Content-type:   text/plain; charset=US-ASCII

It seems that the condition : a<= b <= c is resolved only at the first operator when used in a macro. Say b=4, then 1<= b <= 2 will result (incorrectly) in TRUE, while 2>= b >=1 will correctly resolve to false. Is there a quoting function that has to be used in this situation ?

TIA

Karl Gerber

Example:

NOTE: The initialization phase used 0.31 CPU seconds and 2546K. 1 %LET RPT_TYPE=4; 2 %MACRO MAIN; 3 %IF 1 <= &RPT_TYPE <= 2 %THEN %DO; 4 %PUT EXAMPLE 1: CONDITION NOT RESOLVED CORRECTLY; 5 %END; 6 %ELSE %DO; 7 %PUT EXAMPLE 2: CONDITION RESOLVED CORRECTLY; 8 %END; 9 %MEND; 10 %MAIN; EXAMPLE 1: CONDITION NOT RESOLVED CORRECTLY 11 RUN;

12 %LET RPT_TYPE=4; 13 %MACRO MAIN; 14 %IF 2>= &RPT_TYPE >=1 %THEN %DO; 15 %PUT EXAMPLE 1: CONDITION NOT RESOLVED CORRECTLY; 16 %END; 17 %ELSE %DO; 18 %PUT EXAMPLE 2: CONDITION RESOLVED CORRECTLY; 19 %END; 20 %MEND; 21 %MAIN; EXAMPLE 2: CONDITION RESOLVED CORRECTLY 22 RUN;


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