I have written a SAS/IML module to print a matrix using an optional parameter list. The module is quite simple:
proc iml ;
a={1 2 3, 4 5 6} ;
start print_mat( matrix= ) ;
print 'isSkipped=' (isSkipped( matrix )) ;
print 'isEmpty =' (isEmpty ( matrix )) ;
print 'matrix=' matrix ;
finish ;
run print_mat( a ) ;
run print_mat( matrix=a ) ;
quit ;
and it works for the first invocation of print_mat without the optional parameter syntax, but stumbles for the second invocation where the optional parameter list syntax is used. I do not understand why I get the following error message:
205 run print_mat( matrix=a ) ;
ERROR: (execution) Matrix has not been set to a value.
operation : = at line 205 column 22
operands : matrix, a
matrix 0 row 0 col (type ?, size 0)
a 2 rows 3 cols (numeric)
1 2 3
4 5 6
statement : RUN at line 205 column 1
206 quit ;
Why is 'matrix' considered to be an operand? Why is it considered to be empty?
The error message indicates that the input parameter, matrix, does not point to matrix a. What am I failing to understand about the optional parameter list syntax?