You can use CALL SYMPUT within IML to create macro variables.
The key is to use the CHAR function to make the scalar a character.
The LEFT function is not required, but will result in more attractive
printed output.
Sample Code:
***********************
proc iml;
x= { 1 1 1,
1 2 4,
1 3 9,
1 4 16,
1 5 25,
1 6 36,
1 7 49,
1 8 64 };
n=nrow(x); /* assign n a value - number of observations */
call symput('n',left(char(n)));
/* create the macro variable n with CALL SYMPUT -
need to make the scalar a character with CHAR function */
n2={3.5}; /* can be integer or floating point number */
call symput('n2',left(char(n2)));
new=J(&n); /* can use immediately within IML */
print new;
quit;
%put _user_; /* List the value of user created macro variables */
[an error occurred while processing this directive]
Maintained by:Sandy Donaghy and Joy Smith Last Modified: Wednesday, 02-Oct-2002 09:28:06 EDT
Filename: /working_groups/sas/samples/iml/imlmacrovar.html