data return;
set jyjl;
retain total;
if zqdm ="&hgdm" then /* zqdm与宏变量hgdm相等时,宏变量d_num取num的值1计算收益; */
do;
if hglx= 'rqhg' then
do;
return =(symget('d_num'||zqdm))/360*cjjg*cjsl;
total = sum(total,return);
end;
if hglx= 'rzhg' then
do;
return = -(symget('d_num'||zqdm))/360*cjjg*cjsl;
total = sum(total,return);
end;
else total = total;
end;
run; [/code:bd978]
PROC SQL;
SELECT SUM((CASE S.HGLX
WHEN 'rqhg' THEN NUM
WHEN 'rzhg' THEN -NUM
END) /360*S.cjjg*S.cjsl) AS TOTAL FROM JYJL S,HGDM T
WHERE S.zqdm=T.zqdm;
QUIT;[/code:4b445]作者: shiyiming 时间: 2004-5-21 10:16
宏变量引用需要加双引号,而且你的第一个SYMPUT,执行完了以后,只把最后一个赋给了变量