Chapter Contents |
Previous |
Next |

Working with Matrices |

You can use reduction operators, which return a matrix of reduced dimension, in place of values for subscripts to get reductions across all rows and columns. Table 4.3 lists the eight operators for subscript reduction in IML.

Operator | Action | |

+ | addition | |

# | multiplication | |

<> | maximum | |

>< | minimum | |

<:> | index of maximum | |

>:< | index of minimum | |

: | mean (different from the MATRIX procedure) | |

## | sum of squares |

For example, to get column sums of the matrix
**X** (sum across the rows, which reduces
the row dimension to 1), specify X[+,].
The first subscript (+) specifies that summation
reduction take place across the rows.
Omitting the second subscript, corresponding to
columns, leaves the column dimension unchanged.
The elements in each column are added, and the new
matrix consists of one row containing the column sums.

You can use these operators to reduce either rows or columns or both. When both rows and columns are reduced, row reduction is done first.

For example, the expression A[+,<>] results in the maximum (<>) of the column sums (+).

You can repeat reduction operators. To get the sum of the row maxima, use the expression A[,<>] [+,].

A subscript such as A[{2 3},+] first
selects the second and third rows of **A**
and then finds the row sums of that matrix.
The following examples demonstrate how to
use the operators for subscript reduction.

Chapter Contents |
Previous |
Next |
Top |

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.