This is a rather stupid example but it keeps the essense of what I am trying to do (using SAS university edition):
data TableList;
input tables $ cols  $;
cards;
tab1 col
tab2 cul
;
run; 
%macro test; 
    proc sql;
      select tables
        into:tabs separated by " "          
      from TableList;
    quit;   
    %do i=1  %to 2;           
       %let t = %scan(&tabs,&i);       
       proc sql;
          select cols
        into: col           
          from TableList
          where tables='&t';
       quit;   
       %put &col;          
    %end;   
%mend;
%test;
The problem with this is when I run this code I got this error message:
WARNING: Apparent symbolic reference COL not resolved.
&col
Why is this. Does not sas change &col with its true value at run time?
UPDATE: Setting "&t" instead of '&t' solved my problem. The code is now working.
data TableList;
input tables $ cols  $;
cards;
tab1 col
tab2 cul
;
run; 
%macro test; 
    proc sql;
      select tables
        into:tabs separated by " "          
      from TableList;
    quit;   
    %do i=1  %to 2;           
       %let t = %scan(&tabs,&i);       
       proc sql;
          select cols
        into: col           
          from TableList
          where tables="&t";
       quit;   
       %put Column &col;           
    %end;   
%mend;
%test;