1
を解決できないんこれはかなり愚かな例ですが、それは私が(SAS大学版を使用して)くださいしようとしています何のエッセンスを保持します:SASマクロ変数が
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;
私はこれを実行するとこれに伴う問題がありますコード私はこのエラーメッセージを受け取った:
WARNING: Apparent symbolic reference COL not resolved.
&col
これはなぜですか?実行時に真の値で& colを変更しませんか?
更新日: 「& t」の代わりに「& t」を設定すると、私の問題が解決しました。コードは現在動作しています。ここ
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;