Working with Matrices


More about Missing Values

Missing values in matrices are discussed in ChapterĀ 3: Understanding the SAS/IML Language. You should carefully read that chapter and ChapterĀ 23: Further Notes, so that you are aware of the way SAS/IML software handles missing values. The following examples show how missing values are handled for elementwise operations and for subscript reduction operators.

Consider the following two matrices $\mb{X}$ and $\mb{Y}$:

\[  \mb{X} = \left[ \begin{array}{ccc} 1 &  2 &  . \\ . &  5 &  6 \\ 7 &  . &  9 \\ \end{array} \right] \mb{Y} = \left[ \begin{array}{ccc} 4 &  . &  2 \\ 2 &  1 &  3 \\ 6 &  . &  5 \\ \end{array} \right]  \]

The following operations handle missing values in matrices:

\[  \mbox{Matrix addition: } \mb{X} +\mb{Y} \mbox{ is } \left[ \begin{array}{ccc} 5 &  . &  . \\ . &  6 &  9 \\ 13 &  . &  14 \\ \end{array} \right]  \]
\[  \mbox{Elementwise multiplication: } \mb{X} \#  \mb{Y} \mbox{ is } \left[ \begin{array}{ccc} 4 &  . &  . \\ . &  5 &  18 \\ 42 &  . &  45 \\ \end{array} \right]  \]
\[  \mbox{Subscript reduction: } \mb{X} [+,] \mbox{ is } \left[ \begin{array}{ccc} 8 &  7 &  15 \\ \end{array} \right]  \]