CALL ADDMATRIX Routine
Performs an elementwise addition of two matrices
or a matrix and a scalar.
Category: |
Matrix Operations |
Requirement: |
All input and output matrices must have the same dimensions. |
Syntax
Required Arguments
- X
-
specifies an input
matrix with dimensions m x n (that
is, X[m, n])
or a scalar.
- Y
-
specifies an input
matrix with dimensions m x n (that
is, Y[m, n])
or a scalar.
- Z
-
specifies an output
matrix with dimensions m x n (that
is, Z[m, n]),
such that
Example
The following example
uses the ADDMATRIX CALL routine:
proc fcmp;
array mat1[3,2] (0.3, -0.78, -0.82, 0.54, 1.74, 1.2);
array mat2[3,2] (0.2, 0.38, -0.12, 0.98, 2, 5.2);
array result[3,2];
call addmatrix (mat1, mat2, result);
call addmatrix (2, mat1, result);
put result=;
quit;
Output from the ADDMATRIX CALL Routine
The SAS System 1
The FCMP Procedure
result[1, 1]=2.3 result[1, 2]=1.22 result[2, 1]=1.18 result[2, 2]=2.54
result[3, 1]=3.74 result[3, 2]=3.2