运行程序,提示
ERROR: 用 等于 (=) 的表达式具有不同数据类型的组件
但是我用proc contents 看了,&d2 和
数据库中的字段
F3_1158都是字符8,这是为什么?如何才能正确调用?
另,我用了 like ,还是出错。
%macro WindFetch2(chkDate);
/*Below is Financial indicators 1158*/
data c;
length dd $8;
format dd $8.;
informat dd $8.;
Dyear = substr(&chkDate,1,4);
Dmonth = substr(&chkDate,5,2);
if dmonth in (1 2 3 4 ) then DD= compress(dyear-1||'0630');
else if dmonth in (5 6 7 8 ) then DD= compress(dyear-1||'1231');
else DD= compress(dyear||'0630');
put dyear dmonth dd;
call symput('d2',dd);
run;
proc sql;
create table a as
select b.F4_1158,b.F5_1158,b.F3_1158,b.F9_1158
from wind.tb_object_1090 as a,wind.tb_object_1158 as b
where a.OB_REVISIONS_1090=b.F1_1158 and a.F4_1090='A'
and a.F16_1090='000002'
and b.F3_1158=&d2
order by b.F3_1158;
quit;
%mend;
%WindFetch2('20100331')