When running the code:
proc iml;
mean=%str({0.193,0.156,1.271});
cov=%str({0.003 0.001 0.002, 0.001 0.0003 0.001, 0.002 0.001 0.008});
print cov;
print mean;
x=randnormal(1, mean, cov);
print x;
quit iml;
My log shows:
968 proc iml;
NOTE: IML Ready
969 mean=%str({0.193,0.156,1.271});
970 cov=%str({0.003 0.001 0.002, 0.001 0.0003 0.001, 0.002 0.001 0.008});
971 x=randnormal(1, mean, cov);
NOTE: Module RANDNORMAL loaded from the storage SASHELP.IMLMLIB.
NOTE: Module ROWVEC loaded from the storage SASHELP.IMLMLIB.
ERROR: The covariance matrix is not symmetric positive definite
972 print x;
ERROR: Matrix x has not been set to a value.
statement : PRINT at line 972 column 5
973 quit iml;
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
However, when running the same code with a minor modification, the code runs with success:
proc iml;
mean=%str({0.193,0.156,1.271});
cov=%str({0.003 0.001 0.002, 0.001 0.0004 0.001, 0.002 0.001 0.008});
print cov;
print mean;
x=randnormal(1, mean, cov);
print x;
quit iml;
It appears to be due to the fact that the 0.0003 in the first code is too small for randnormal because 0.0004 allows the code to run successfully.
Any thoughts on this?