Date: Mon, 18 Jan 2010 06:15:03 -0500
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: 'IN' in macros
Content-Type: text/plain; charset=ISO-8859-1
In addition to the solutions already presented:
macro _IN_ (originally IN, 2005) from
http://jim.groeneveld.eu.tf/software/SASmacro/_IN_.zip
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
http://jim.groeneveld.eu.tf
On Mon, 18 Jan 2010 00:56:21 -0500, S=?ISO-8859-1?Q?=C3=B8ren?= Lassen
<s.lassen@POST.TELE.DK> wrote:
>If you do not have SAS 9.2, an option is to use indexw:
>%if %sysfunc(indexw(1 2 3,&a))....
>
>Regards,
>Søren
>
>On Fri, 15 Jan 2010 09:46:03 -0500, sas biology <sasbio@GMAIL.COM> wrote:
>
>>Hello All,
>>
>>How can I do this using Macros?
>>
>>if a *in* (1 2 3) then b=a;
>>else b=a=1;
>>
>>I can think of doing it in macros this way:
>>
>>%if *&a=1 or &a=2 or &a=3* %then %do;
>>b=&a;
>>%end;
>>%else %do;
>>b=%eval(&a+1);
>>%end;
>>
>>I am sure there must be a better way of doing it. Can someone spend some
>>time on this?
>>I specifically want to know how to avoid using 'OR' as in *&a=1 or &a=2 or
>>&a=3* and how to do it in a simple way.
>>**
>>Thanks
>>SB
|