You can define one module while in the midst of defining another. Each module definition must be completely contained inside the parent module definition, as shown in the following example:
start ModA; start ModB; x = 1; finish ModB; run ModB; finish ModA; run ModA;
In this example, SAS/IML software starts parsing statements for a module called ModA. In the middle of this module definition, it recognizes the start of a new module called ModB. It parses ModB until it encounters the first FINISH statement. It then finishes parsing ModA.
Although it looks like ModB might be "local" to ModA, that is not the case. The previous statements are equivalent to the following:
start ModB; x = 1; finish ModB; start ModA; run ModB; finish ModA; run ModA;
In particular, you can call the ModB module from the program’s main scope or from other modules. The SAS/IML language does not support local modules. All modules are defined at global scope.