define a function on SAS IML
proc iml;
/* square each element of a matrix */
start Sqr(x);
return( x#x ); /* elementwis multiplication */
finish;
x = 1:5; /* x = {1 2 3 4 5} */
y = Sqr(x); /* square each element: y = {1 4 9 16 25} */