Because of the macro call, the ERROR message doesn't give any useful information about which LOG call is failing.Two suggestions: 1) For debugging, define %LET i=2; %LET mcno = 10000; and get rid of the other macro statements. 2) You have many LOG statements, but we don't know which temporary argument is going negative. Go through the code and assign real variables to the arguments: temp1 = ff/nrow(uu); temp2 = det(Vi); etc. Then run the program. When the program fails you'll get a real line number that points to the error, and you'll get the actual name of a variable that is negative. For example, if temp1 is negative, you'll get the error message: ERROR: (execution) Invalid argument to function. operation : LOG at line XXXX column CCC operands : TEMP1 TEMP1 1 row 1 col (numeric) 0 Rick SAS/IML blog: http://blogs.sas.com/content/iml PS. Unless I'm mistaken, your first call to PROC IML just fills an (&mcno x 2) matrix with uniform random values. You can just use uu1=J(&mcno,2,.); call randgen(uu1, "Uniform");
... View more