do 在宏内循环
下面的代码返回以下错误消息:
语法错误,需要以下之一:名称、INPUT、PUT。
%macro run_calculation(amt, t, r);
data customer_value;
i=&r./100.;
do n=0 to t;
S=&amt.*[(1+ calculated i)^t - 1]/calculated i
end;
run;
%mend;
%run_calculation(amt=1000, t=8, r=5);
预期输出是表中每个 t 的 S 值。
The code below is returning the following error message:
Syntax error, expecting one of the following: a name, INPUT, PUT.
%macro run_calculation(amt, t, r);
data customer_value;
i=&r./100.;
do n=0 to t;
S=&amt.*[(1+ calculated i)^t - 1]/calculated i
end;
run;
%mend;
%run_calculation(amt=1000, t=8, r=5);
Expected output is S value at each t in a table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很少有评论:
**
,而不是^
。t
,而不是do loop语句中的宏观变量& t。
。n
,而不是t
,因此您需要在公式中使用n
。Few comments:
;
when assigning S.calculated i
, usei
directly.**
and not^
.t
instead of the macro-variable&t.
in the do loop statement.n
, nott
so you need to usen
in your formula.