此宏字符串比較以神祕的方式爲我工作。對我來說很明顯,%test1(intotest)
和%test2(intotest)
的結果是相等的。sas宏字符串比較不等同於相同的方式
%macro test1(intotest=);
%str(&intotest) = %str("b");
%mend;
%macro test2(intotest);
%if %str(&intotest) = %str("b") %then
1;
%else 0;
%mend EAF;
data datatable;
fromtable = 'b';
test1 = %test1(intotest=fromtable);
test2 = %test2(intotest=fromtable);
run;
輸出是 fromtable=b,test1=1,test2=0
我將如何改寫%test2()
,以便它給出了相同的結果%test1()
並仍然使用信息的數據表作爲輸入?
這是一個可怕的宏代碼使用。請不要使用這個。除非這是一項學術活動,否則你真的想做什麼? Proc fcmp用於功能。 – Reeza
'%修補EAF'是什麼意思?我只使用沒有參數的'%mend'或者你想結束的宏的名字。 –
@StigEide「警告:對宏定義TEST1忽略了%MEND語句上的無關文本。」 –