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 ($-$) 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 24: Language Reference.

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

Table 5.1: Operator Precedence

Priority Group

 

Operators

I (highest)

 

^

\`{~ }

subscripts

$-$(prefix)

##

**

II

 

*

#

<>

><

/

@

III

 

+

$-$

       

IV

 

$\| $

//

:

     

V

 

<

<=

>

>=

=

^=

VI

 

&

         

VII (lowest)

 

|