Date: Thu, 18 Nov 1999 13:21:36 +0000
Reply-To: roland.rashleigh-berry@virgin.net
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland.rashleigh-berry@VIRGIN.NET>
Organization: N/A
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;
>
> %test(6);
>
> 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:
IF 1<=6<=3
...but since all SAS macro variables are character and the syntax
doesn't support this contruct in the SAS/Macro language this is
equivalent to:
if "1" <= "6<=3"
...and sure enough it is true and that is why the "ONE TO THREE" message
is displayed.
> 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?
Nuffink.
> another method '1 <= &qno and &qno <= 3 ' is right.
> but why is different result?
> please. give me answer.
As explained above. Hope this helps.
Roland