楼主: royalty
6442 1

[原创博文] 悬赏求解答:调用数据库,提示等式=两边具有不同数据类型的组件 [推广有奖]

  • 0关注
  • 0粉丝

小学生

35%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
90 点
帖子
3
精华
0
在线时间
3 小时
注册时间
2009-5-19
最后登录
2012-2-2

楼主
royalty 发表于 2012-2-2 10:19:06 |AI写论文
14论坛币
运行程序,提示
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')

关键词:数据类型 数据库 求解答 Indicators Indicator

沙发
jingju11 发表于 2012-2-3 03:57:35
b.F3_1158="&d2"
jingju

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-6 06:18