SAS Institute. The Power to Know

SAS/IML(R) 9.2 User's Guide


Understanding the Interactive Matrix Language

Defining a Matrix

The fundamental data object on which all Interactive Matrix Language commands operate is a two-dimensional (row x column) numeric or character matrix. By their very nature, matrices are useful for representing data and efficient for working with data. Matrices have the following properties:

  • Matrices can be either numeric or character. Elements of a numeric matrix are stored in double precision. Elements of a character matrix are character strings of equal length. The length can range from 1 to 32676 characters.
  • Matrices are referred to by valid SAS names. Names can be from 1 to 32 characters long, beginning with a letter or underscore, and continuing with letters, numbers, and underscores.
  • Matrices have dimension defined by the number of rows and columns.
  • Matrices can contain elements that have missing values (see the section "Missing Values").

The dimension of a matrix is defined by the number of rows and columns it has. An m x n matrix has mn elements arranged in m rows and n columns. The following nomenclature is standard in this user's guide:

  • 1 x n matrices are called row vectors.
  • m x 1 matrices are called column vectors.
  • 1 x 1 matrices are called scalars.