SAS/IML – Interactive Matrix Language
March 23, 2005
Presented by the
ITC Research Computing Support Group
Kathy Gerber, Ed Hall, Katherine Holcomb,
Tim F. Jost Tolson
Finding Global Optima with the Genetic Algorithm/ Direct
Search Toolbox, Wednesday, April 6, 3:30 PM
Statistical Shape Analysis, Wednesday, April 20, 3:30 PM
Objected Oriented Programming with Fortran 95, Wednesday,
April 27, 3:30 PM
SAS Interactive Matrix Language
Overview of SAS/IML
Language nuts and bolts – sample programs
IML Workshop 2.1
Features of SAS/IML
Is a programming language.
Has has a complete set of control statements.
Operates on matrices.
Has a powerful vocabulary of operators.
Can use operators that apply to entire matrices.
Can be interactive.
Can produce graphics.
When to Use SAS/IML
If SAS is currently your major tool for data analysis and
quantitative research, then SAS/IML software as a programming
language extends the capability of the existing environment.
When an environment combining existing statistical/
mathematical procedures and versatile programming capability is
If a calculation is unavailable in SAS/STAT or Base SAS, write
the core algorithm in an IML module.
When additional flexibility and integration are required for tasks
such as data acquisition, generation and transformation,
obtaining and reusing results, and regular expression parsing.
Matrix operations are not optimized.
Base SAS, SAS/IML and SAS Macro languages
Limitations on data structures.
You can access SAS data sets or external files
with an extensive set of data processing
commands for data input and output
You can also edit existing SAS data sets or
create new ones
You can leverage familiar statistical procedures
from within your code
Numerical Functions and Algorithms
Implemented with SAS/IML
Many Base SAS functions are accessible from SAS/IML
Subroutines for outlier detection and robust regression
Time Series Analysis
Genetic Algorithms – Experimental
Sparse Matrices – Experimental
Monte Carlo Simulation – see
A Few Programs That Use SAS/IML
Sample programs installed with your installation:
Located in directory C:\Program Files\SAS\SAS 9.1\iml\sample
Samples included in SAS Online Documentation for SAS/IML:
A collection of SAS macro programs using SAS/IML software to generate, randomize
and inspect orthogonal arrays for computer experiments and integration.
SAS for Monte Carlo Studies: A Guide for Quantitative Researchers: By Xitao Fan,
Akos Felsovalyi, Stephen A. Sivo, and Sean C. Keenan:
Example for this talk:
SAS Program: http://www.itc.virginia.edu/research/talks/sasiml.sas
Data Set: http://www.itc.virginia.edu/research/talks/gpa.sas7bdat
Starting SAS program:
SAS/IML Workshop 2.1
SAS/IML Workshop is a graphical user interface
and extension of SAS/IML software.
Enables you to explore data interactively using
standard statistical graphics and tables.
Provides an integrated development
environment for writing, debugging, and
executing IML programs.
Using IML Workshop, you can:
Analyze data using interactive statistical graphics. IML Workshop
provides bar charts, box plots, contour plots, histograms, line plots,
mosaic plots, and two- and three-dimensional scatter plots.
Execute SAS procedure steps from within your IMLPlus programs. This
enables you to extend IML's capabilities with the power of SAS' analytic
Develop interactive data analysis programs using dialog boxes.
Call your own computational routines written in C, Fortran, or Java.
System Requirements and Download
SAS/IML Workshop requires a PC running the Microsoft® Windows
operating system - Windows 98/ME/NT4/2000/XP .
First install SAS Release 8.2 or Release 9.1
Sun Microsystems's Java Runtime Environment (JRE) version 1.4.1 or later
must be installed. You can download the latest JRE from Sun's Java Web site:
If you are using Windows 98, Microsoft DCOM98 version 1.3 must be
installed. You can download DCOM98 1.3 from Microsoft's Web site:
Pentium-compatible processor with a clock speed of 233 MHz or higher.
Memory - A minimum of 64MB RAM is required; 128MB RAM or more is
Hard disk requirements – 62MB required to install.
Request download from
Differences in IMLPlus
The mechanism for mixing IML with DATA steps and other
PROC steps is different in IMLPlus. Refer to the help topic
Accessing SAS Functionality.
IMLPlus programs do not require the statements proc iml or
The following low-level graphics routines are not supported:
display, gpie, gpiexy, gpoint, gpoly, gport, gportpop, gportstk,
gscript, gset, gshow, gstart, gstop, gstrlen, gtext, gvtext, gwindow,
gxaxis, gyaxis, and window. In their place IMLPlus provides
high-level statistical graphics.
Starting IML Workshop:
PROC/IML can be an ideal tool within an
existing SAS context or for small to midsize
independent numerical programming projects
IML Workshop 2.1 is particularly handy for
quick point-and-click interactive dynamic
visualization of numerical data
NOT “silver bullets” but useful tools