Working with Matrices

Compound Expressions

With SAS/IML software, you can write compound expressions involving several matrix operators and operands. For example, the following statements are valid matrix assignment statements:

  
    a=x+y+z; 
    a=x+y*z\prime ; 
    a=(-x)#(y-z);
 

The rules for evaluating compound expressions are as follows:

When multiple prefix or postfix operators are juxtaposed, precedence is determined by their order from inside to outside.

For example, the following expression is evaluated as (a\grave{})[i,j]:

  
          a`[i,j]
 

  • All expressions enclosed in parentheses are evaluated first, using the two preceding rules. Consider the following statement:
      
              a=x/(y/z);
     
    This statement is evaluated by first dividing elements of y by the elements of z, then dividing this result into x.
  • Previous Page | Next Page | Top of Page