A module definition begins with a START statement, which has the following general form:
START <name> <( arguments )> <GLOBAL( arguments )> ;
A module definition ends with a FINISH statement, which has the following general form:
FINISH <name>;
If no name appears in the START statement, the name of the module defaults to MAIN. If no name appears on the FINISH statement, the name of the most recently defined module is used.
There are two ways you can execute a module: you can use either a RUN statement or a CALL statement. The general forms of these statements are as follows:
RUN name <( arguments )>;
CALL name <( arguments )>;
The main difference between the RUN and CALL statements is the order of resolution. If you define a module that has the same name as a SAS/IML subroutine, you can use the RUN statement to call the user-defined module and the CALL statement to call the built-in subroutine. For more on the order of resolution, see Order of Resolution for Functions and Subroutines.
The RUN and CALL statements must have arguments that correspond to the ones defined in the START statement. A module can call other modules but cannot recursively call itself.
After the last statement in a module is executed, control returns to the statement that initially called the module. You can also force a return from a module by using the RETURN statement .