Working with Matrices

Operators

Operators used in matrix expressions fall into three general categories:

Prefix operators

are placed in front of operands. For example, -A uses the sign reversal prefix operator (minus) in front of the matrix A to reverse the sign of each element of A.

Binary operators

are placed between operands. For example, A + B uses the addition binary operator (+) between matrices A and B to add corresponding elements of the matrices.

Postfix operators

are placed after an operand. For example, A‘ uses the transpose postfix operator (`) after the matrix A to transpose the matrix.

Matrix operators are described in detail in Chapter 25, Language Reference.

Table 1 shows the precedence of matrix operators in the SAS/IML language.

Table 1: Operator Precedence

Priority Group Operators
I (highest) ^
External File:images/imlug_workmatrix0001.png
subscripts minus(prefix) ## **
II * # <> >< / @
III + minus
IV double-vertical-bar // :
V < <= > >= = ^=
VI &
VII (lowest) |


Last updated: July 20, 2026