程序及报错信息如下:
32 data invest;
33 do year=2010 to 2018;
34 capital+5000;
35 capital*(1+4.5%);
_______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
36 end;
37 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.INVEST may be incomplete. When this step was stopped there were 0 observations and 2 variables.
WARNING: Data set WORK.INVEST was not replaced because this step was stopped.
上面是程序报错信息,修改后的程序如下,能正确显示结果。
data invest;
do year=2010 to 2018;
capital+5000;
capital+capital*0.045;
end;
run;
我的疑惑有3点:
1、我知道%好像是宏代码的时候用的,但体现具体数字4.5%的时候也不能用吗?
2、颜色标记的地方为什么不能合并呢?
3、循环计算的时候,代码都是表达式,为什么不是等式呢?比如capital=capital+5000?
我是新手,目前在自学SAS,恳请各位大大帮忙解惑,谢谢!