|
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;
>>
|