SAS Institute. The Power to Know

SAS/IML(R) 9.2 User's Guide

Previous | Next
Programming Statements

Module Definition and Execution

Modules are used for two purposes:

  • to create groups of statements that can be invoked as a unit from anywhere in the program - that is, to make a subroutine or function
  • to create a separate (symbol-table) environment - that is, to define variables that are local to the module rather than global

A module always begins with a START statement and ends with a FINISH statement. Modules can be thought of as being either functions or subroutines. When a module returns a single parameter, it is called a function and is executed as if it were a built-in IML function; a function is invoked by its name in an assignment statement rather than in a CALL or RUN statement. Otherwise, a module is called a subroutine, and you execute the module in either the RUN statement or the CALL statement.


Defining and Executing a Module

Nesting Modules

Understanding Symbol Tables

Modules with No Arguments

Modules with Arguments

More about Argument Passing

Module Storage

Previous | Next | Top of Page