%macro var_in_list(z);
proc contents data=&z. noprint out=cont(keep= name);
run;
proc sql noprint;
select Name into :VarList separated by ' '
from cont;
quit;
proc sql noprint;
select count(*) into :count from cont; quit;
%put &count.;
%put &VarList.;
%let a=;
%let finish=%sysfunc(countw(&VarList));
%do i = 1 %to &finish;
%put var_&i= %scan(&varlist., &i, " ");
%ordinal(var_&i);
%end;
/*%do j=1 %to &finish;*/
/* %ordinal(a_:);*/
/*%end;*/
%mend var_in_list;
&varlist.=WOE_ASSET_TYPE WOE_CURRENT_ASSETS WOE_CURRENT_LIABILITIES_1 WOE_DEPRECIATION_1
WOE_DebtAmount WOE_Delta_TL WOE_Delta_TS WOE_Delta_interest WOE_Delta_npbt WOE_Delta_taxes WOE_EBITDA_COVERAGE WOE_EFA
WOE_EPP WOE_IsCodebtor WOE_NACE WOE_OutstandingAmount WOE_PPLTL WOE_PPTA WOE_PRODUCT WOE_P_price WOE_TEENOR WOE_T_L1
WOE_max_LD_1 WOE_max_LD_2 WOE_max_LD_3 WOE_max_LD_4 WOE_max_LD_5 WOE_max_LD_6 WOE_max_LD_7 WOE_max_LD_8 WOE_max_LD_9
WOE_max_LD_10 WOE_max_LD_12 delnum percbad tot
I want:
%ordinal(WOE_ASSET_TYPE); %ordinal(WOE_CURRENT_ASSETS); etc.
I'm just trying to automate a simple process due to lazyness.
You are referencing a macro variable you never create. You don't really need any macro varaiable. You can just pass the results of the scan to the macro call.
%do i = 1 %to &finish;
%ordinal(%scan(&varlist., &i, %str( ) ));
%end;
Note your call to %SCAN() is setting both space and double quote as the delimiter characters. It will not have any impact unless some of the variable names actually include double quote characters.