proc iml;
a={1 -2 3,-5 4 0,2 1 0};
b={1,2,3};
do;
if det(a)=0 then goto negative;
x=inv(a)*b; print a b x;
negative:print "The equation is unresolved";
end;
run;
quit;
这里为什么要用DO来限制啊,我刚开始没用DO ,日志窗口就一直显示出错 ,就是下面这个显示有错误
proc iml;
a={1 -2 3,-5 4 0,2 1 0};
b={1,2,3};
if det(a)=0 then goto negative;
x=inv(a)*b; print a b x;
negative:print "The equation is unresolved"
run;
quit;
日志错误信息是这样的NOTE: IML Ready
2 a={1 -2 3,-5 4 0,2 1 0};
3 b={1,2,3};
4 if det(a)=0 then goto negative;
5 x=inv(a)*b;
ERROR: Unresolved label: NEGATIVE
5 ! print a b x;
ERROR: Matrix x has not been set to a value.
statement : PRINT at line 5 column 20
6 negative:
6 ! print "The equation is unresolved"
7 run;
ERROR: Matrix run has not been set to a value.