SAS Institute. The Power to Know

FOCUS AREAS

SAS/IML Software: Features

Features


Matrices and Matrix Operators

The fundamental IML data object is a two-dimensional (row-by-column) numeric or character matrix. Matrices are useful for representing data and are very efficient for working with data. For example, suppose you measured the daily high temperatures in September for six different cities and want to convert the readings from Fahrenheit to Celsius. You could write code such as

  do i=1 to 30;
    do j=1 to 6;
      C[i,j]=5*(F[i,j]-32)/9;
    end;
  end;

where C[1,6] is the temperature in Celsius on September 1 for city 6. Such operations can be very slow and difficult to program for complex formulas and large datasets; however, in SAS/IML you load your data into matrix F and simply write

  C=5*(F-32)/9;

Matrix Operators

Basic operators are provided that perform: arithmetic operations on each element of the matrix (elementwise operations, as illustrated in the previous example), matrix operations, concatenation of matrices, comparisons between and within matrices, subscripting of matrices, and subscript reduction (for example, take the sum of squares of each row of a matrix).


Control Statements

These statements direct the flow of execution of IML statements, and enable program modularization. The control statements include IF-THEN...ELSE, DO...END, iterative DO, DO WHILE, DO UNTIL, GOTO, LINK, RETURN, STOP, and ABORT.


Functions and Call Routines

The power of the SAS/IML language is released with the many matrix functions and call routines provided, ranging from general matrix functions to complex numerical integration and optimization routines. The following lists some of the operations that can be performed:

General Matrix Functions

Linear Algebraic and Statistical Functions

Time Series Functions

Numerical Analysis Functions


IML Modules and Subroutines

You can extend the power of SAS/IML by writing your own functions and routines and storing them as "modules" in libraries. Libraries can contain both functions and subroutines; functions can be invoked in assignment statements or expressions, while subroutines can be invoked using CALL or RUN statements. IML automatically loads, resolves, and executes a module when you use it.

The IMLMLIB Module Library contains several modules which may be used as though they were built-in functions of IML. The IMLMLIB modules enable you to:


Graphics Commands

A powerful set of commands, called graphics primitives, are provided to create customized displays. Several basic commands are GDRAW (for drawing a line), GPOINT (for plotting points), and GPOLY (for drawing a polygon). A set of attributes such as color and linestyle can be associated with each primitive. Collections of graphics primitives can be saved as a segment, which can be included in subsequent graphs; graphs can be included on the same page.


Statistics and Operations Research Home Page | SAS/IML Software