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 (March 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 4 Mar 2009 08:50:33 -0500
Reply-To:     Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:      Re: urgent

I sometimes also saw the %index function to do something like the IN operator:

%macro test; %do i=1 %to 5; %if %index(*1*2*3*,&i) %then %do; %put ok for I=&i; %end; %else %do; %put &i is not in 1 2 3; %end; %end; %mend; %test;

Gerhard

On Wed, 4 Mar 2009 10:51:53 +0000, karma <dorjetarap@GOOGLEMAIL.COM> wrote:

>You have a bit of a mixture of data step code and macro code here. The >macro language doesn't support the in function as of yet, so you can >either code the options explicitly in the macro code, or bring it into >the datastep. > >%macro test ; > %let i=1 ; > %if &i eq 1 or &i eq 2 or &i eq 3 %then > %let inds=eff_auc ; > %else %if &i eq 3 or &i eq 4 or &i eq 5 %then > %let inds=pk ; > %put &inds ; >%mend; >%test ; > >%let i=4 ; >data _null_ ; > if &i in (1 2 3) then call symputx('inds','eff_auc') ; > else if &i in (3 4 5) then call symputx('inds','pk') ; > run ; >%put &inds ; > >2009/3/4 Shaik Hymad <hymadsk@gmail.com>: >> Please correct the below statement : >> >> >> >> if &i in (1 2 6) then %let inds=eff_auc; >> %else %if &i in (3 4 5) %then %let inds=pk; >>


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