yongyitian 发表于 2016-1-19 11:18
宏里面的 %IF ... %then 语句是比较两个字符串的大小。
你的程序中 第一个%if 语句比较的是 字符 "20346" ...
不太同意你的观点。
根据下面的程序和结果,%sysfunc(intnx(month,'15SEP2015'd,3,s))和20346或者“20346”并不相等。
第一个%if 语句比较的自然也不是 字符"20346" 与 "‘15DEC2015’d" 的大小。
%macro test;
%if %sysfunc(intnx(month,'15SEP2015'd,3,s))=20346 %then %put aa;
%else %put bb;
%if %sysfunc(intnx(month,'15SEP2015'd,3,s))=20437 %then %put aa;
%else %put bb;
%if %sysfunc(intnx(month,'15SEP2015'd,3,s))='20346' %then %put aa;
%else %put bb;
%if %sysfunc(intnx(month,'15SEP2015'd,3,s))='20437' %then %put aa;
%else %put bb;
%mend;
%test;
结果是
bb
aa
bb
bb