I run the code to optimizing loglikelihood like the following in SAS9.2/IML:
start ML (x) ;
dp=1;x1=2;,x2=3;
star ls(a) global(dp, x1,x2);
z=SSQ(dp-a[1]#x1-a[2]#x2);
return(z);
finish LS;
x={3 3};
call nlpnrr(rc,rx,"LS",x);
....
finish ML;
x={0,1};
call nlpnms(rc,xr,"ML",x);
there is a error message in log window as following:
ERROR: (execution) Matrix has not been set to a value.
operation : # at line 1803 column 30
operands : _TEM1001, x1
_TEM1001 1 row 1 col (numeric)
3
x1 0 row 0 col (type ?, size 0)
statement : ASSIGN at line 1803 column 17
traceback : module LS at line 1803 column 17
module ML at line 1635 column 1
ERROR: (execution) Matrix has not been set to a value.
operation : NLPNRR at line 1686 column 16
operands : *LIT1074, x, , con
*LIT1074 1 row 1 col (character, size 2)
ls
x 1 row 2 cols (numeric)
3 3
con 2 rows 2 cols (numeric)
. .
. 50
statement : CALL at line 1686 column 16
traceback : module ML at line 1686 column 16
When i use a Global clause in Start ML(x) as
Start ML(x) Global(dp, x1,x2);
there is not error message.
My question is :
Since x1 and x2 are defined with global clause in moldule ML before model LS, they are global variables for module LS, Why error message say that? What's the function of the Global clause in "Start ML(x) Global
(dp, x1,x2);"
Thanks alot!