2# 爱萌
报一样的错误啊,如下:
283
284 proc iml;
NOTE: IML Ready
285 use dataset1;
286 read all into data;
287 show names;
288 print data;
289 start maxFunc(X) global(data);
290 sum=0;
291 do i=1 to 10;
292 U[1]=X[1]*data[i,2]+X[2]*data[i,3];
293 U[2]=X[1]*data[i,4]+X[2]*data[i,5];
294 U=U[1]*data[i,6]+U[2]*data[i,7]+X[3]*data[i,8];
295 sum=sum- log(exp(U[1]-U)+exp(U[2]-U)+exp(X[3]-U));
296 end;
297 return(sum);
298 finish maxFunc;
NOTE: Module MAXFUNC defined.
299
300 optn={1 2};
301 X=J(1,4,0);
302 call nlpcg(xres,rc,"maxFunc",X,optn);
ERROR: (execution) Matrix has not been set to a value.
operation : [ at line 292 column 6
operands : U, *LIT1004, _TEM1007
U 0 row 0 col (type ?, size 0)
*LIT1004 1 row 1 col (numeric)
1
_TEM1007 1 row 1 col (numeric)
0
statement : ASSIGN at line 292 column 5
traceback : module MAXFUNC at line 292 column 5
ERROR: (execution) Matrix has not been set to a value.
operation : NLPCG at line 302 column 5
operands : *LIT1027, X, OPTN
*LIT1027 1 row 1 col (character, size 7)
maxFunc
X 1 row 4 cols (numeric)
0 0 0 0
OPTN 1 row 2 cols (numeric)
1 2
statement : CALL at line 302 column 5
303 run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
304 quit;
现在不明白怎么会读不到数据的?