CALL ELEMMULT Routine

Performs an elementwise multiplication of two matrices.
Category: Matrix Operations
Requirement: All input and output matrices must have the same dimensions.

Syntax

CALL ELEMMULT(X, Y, Z);

Required Arguments

X
specifies an input matrix with dimensions m x n (that is, X[m, n]).
Y
specifies an input matrix with dimensions m x n (that is, Y[m, n]).
Z
specifies an output matrix with dimensions m x n (that is, Z[m, n]).

Example

The following example uses the ELEMMULT CALL routine:
options pageno=1 nodate;

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 elemmult (mat1, mat2, result);
   call elemmult (2.5, mat1, result);
   put result=;
 quit;
Output from the ELEMMULT CALL Routine
                                The SAS System                               1

                              The FCMP Procedure

result[1, 1]=0.75 result[1, 2]=-1.95 result[2, 1]=-2.05 result[2, 2]=1.35
result[3, 1]=4.35 result[3, 2]=3