Date: Thu, 18 Nov 1999 13:21:36 +0000
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland.rashleigh-berry@VIRGIN.NET>
Subject: Re: Macro Problem...
Content-Type: text/plain; charset=us-ascii
Choi Kyoung eun wrote:
> %MACRO TEST(QNO);
> %LOCAL QNO;
> %IF 1<=&QNO<=3 %THEN %PUT &QNO 'ONE TO THREE';
No, no, no. SAS/Macro language syntax is not the same as SAS language
syntax. Just as you have "a=55;" in SAS language you need to write "%let
a=55;" in SAS/Macro language. It is different. The "10<=var<=20" type of
contrauct exists in SAS language but not in SAS/Macro language.
> %ELSE %PUT 'OUT OF RANGE';
> %MEND TEST;
> log> ONE TO THREE
So you passed it the *character* six (all SAS macro variables are
character whether you expect it or not). The test you have performed is:
...but since all SAS macro variables are character and the syntax
doesn't support this contruct in the SAS/Macro language this is
if "1" <= "6<=3"
...and sure enough it is true and that is why the "ONE TO THREE" message
> I think the result was wrong.
> and no error message.
It's not an error as far as SAS/Macro language is concerned.
> What's Wrong?
> another method '1 <= &qno and &qno <= 3 ' is right.
> but why is different result?
> please. give me answer.
As explained above. Hope this helps.