Peter Flom reminded readers of his blog that you should always end a SAS procedure with a RUN statement. This is good rule. However, PROC IML is an exception to the rule.
In PROC IML, the RUN statement is used to execute a built-in subroutine or a user-defined module. You should not use RUN as the last statement in a SAS/IML program.
If you use other SAS statistical procedures, you might find this behavior strange. In other procedures—even other interactive procedures—no statements are executed until the procedure encounters a RUN statement. Not so with PROC IML. Each statement (or block of statements) is executed as soon as you submit it.
When you are finished using PROC IML, use the QUIT statement to exit the procedure.
6 Comments
The key point, I believe, is to always conclude your use of proc IML with a QUIT. Well, the fact that RUN can mean something different within the context of IML studio is important, too. (It doesn't always mean something different, e.g. within a submit/endsubmit.)
However, if you want to enter a "run;" after the QUIT then that is fine and it will have no effect other than to make you code structure look more regular/familiar.
Pingback: SAS tip: Put ODS statements inside procedures - The DO Loop
Pingback: How to stop processing your SAS/IML program if a certain condition is met - The DO Loop
Pingback: The difference between RUN and CALL for SAS/IML subroutines - The DO Loop
Pingback: Running interactive procedures in SAS Studio and SAS University Edition - The DO Loop
Pingback: Do you write unnecessary SAS statements? - The DO Loop