IML Macro Programming Language

Contents Index <<Browse<< >>Browse>>


IML has all the capabilities of a programming language. User defined functions and call routines (referred to as modules) can be used to extend the built in capabilities.

User defined functions consist of programming statements enclosed between start and finish statements. As an example, the function add which computes the sum of its arguments is defined by

start add(x,y);
sum=x+y;
return(sum);
finish add;

The parameters in a module definition are dummy variables.

Variables used within a module are local variables.

The value to be returned by the function module is given in a return statement.

Modules and matrices can be stored on disk and reloaded for use in later IML sessions using store and load commands.

The usual programming constructs are available for use both inside and outside of modules. In particular, if-then and if-then-else constructs are available, as are do-end loops. The use of these constructs is as in the SAS data step. GOTO statements can be used too. The label for the GOTO statement consists of a name followed by a colon. Example:

start absolute(x);
if x>0 then goto pos;
y=-x;
return (y);
pos:
return(x);
finish absolute;

is an incarnation of the absolute value function.

For further information see online help under HELP--SAS SYSTEM--MODELING AND ANALYSIS TOOLS--INTERACTIVE MATRIX LANGUAGE or Chapter 5 of SAS/IML Software.


Contents Index <<Browse<< >>Browse>>

Copyright © 1997 by Jerry Alan Veeh. All rights reserved.