Language Reference |
raises each element to a power
The elementwise power operator (##) creates a new matrix with elements that are the elements of matrix1 raised to the power of the corresponding element of matrix2. If any value in matrix1 is negative, the corresponding element in matrix2 must be an integer.
In addition to handling conformable matrices, the elementwise power operator enables either operand to be a scalar or a row or column vector. If either operand is scalar, the operation takes the power for each element and the scalar value. If either operand is a row or column vector, the operation is applied elementwise using the vector on each row or column of the matrix.
Missing values are propagated if they occur.
For example, the following statements produce the matrix , as shown:
a={1 2 3}; b=a##3;
B 1 row 2 cols (numeric) 1 8 27The following statement produces the new matrix , as shown:
b=a##.5;
B 1 row 3 cols (numeric) 1 1.4142136 1.7320508
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.