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 (June 1997, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 30 Jun 1997 20:23:17 +1200
Reply-To:   Tom Robinson <Tom.Robinson@ACTRIX.GEN.NZ>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Tom Robinson <Tom.Robinson@ACTRIX.GEN.NZ>
Organization:   Internet ProLink NZ Limited, Auckland
Subject:   Re: Macro question

In article <5p13pf$hmt@alexander.INS.CWRU.Edu>, pat@po.CWRU.Edu (Paul A. Thompson) wrote:

[...] >>For this particular situation, namely, the possible values for a, >>you can try the following: >>%let check=(23,45,69,93); >>%if %index(check,&a)=0 %then %let b=2; >> %else %let b=1; >> > >This simply won't work for many cases. How about cases where &a=3? > >To the best of my knowledge, you can't get around the need for a loop. [...]

How 'bout something like:

%let check=x23x45x69x93x; %if %index(&check,x&a.x)=0 %then %let b=2; %else %let b=1;

Commas would be nicer delimeters, and you can wrap them around &check inside the %index so the %let looks more SAS like (%let check=23,45,69,93;), but I can't be bothered with quoting at this time of night!

Cheers -- 8 Bare The box said "Requires Windows 95, or better", so I bought a o-+-o Foot Macintosh < > Guru


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