Date: Mon, 3 Nov 2008 15:23:41 +1100
Reply-To: Scott Bass <sas_l_739.at.yahoo.dot.com.dot.au@PESTO.CC.UGA.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Scott Bass <sas_l_739.at.yahoo.dot.com.dot.au@PESTO.CC.UGA.EDU>
Subject: Re: A SAS macro variable question
See
http://support.sas.com/kb/11/945.html and
http://support.sas.com/documentation/cdl/en/mcrolref/59526/HTML/default/a002475219.htm
Try using a space for the delimiter per the documentation.
You don't need the quotation marks, since macro is text tokens that are
resolved before the program is compiled.
So try something like
%if (&ds in apple pear orange) %then %do; %put IT WORKED; %end;
HTH,
Scott
""A.B."" <alicia.bingo@GMAIL.COM> wrote in message
news:72fda1cf0810311202j21f293flf48e4934c3bc45ce@mail.gmail.com...
> Hi,
>
> I have a simple macro that I use to create dataset. In the macro I check
> to
> see if the variable name is in a list of strings:
>
> %macro mydata(ds);
> ...
> %if "&ds" in ("apple", "pear", "orange") %then
> pid=substr(id,1,6);
> ...
> %mend;
>
> The macro variable was resolved correctly, but SAS gave the following
> message:
>
> ERROR: Required operator not found in expression: "&ds" in ("apple",
> "pear",
> "orange")
> ERROR: The macro MYDATA will stop executing.
>
>
> This seemed working OK in SAS 9.1 but not in SAS 9.2. Can anyone tell me
> what might be the problem?
>
> Thanks,
> --
> A.B.
|