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 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 18 Jan 2010 00:56:21 -0500
Reply-To:     Søren Lassen <s.lassen@POST.TELE.DK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Søren Lassen <s.lassen@POST.TELE.DK>
Subject:      Re: 'IN' in macros
Comments: To: Sas Biology <sasbio@GMAIL.COM>
Content-Type: text/plain; charset=ISO-8859-1

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


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