Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Programming Statements

Modules with No Arguments

When you define a module with no arguments, a local symbol table is not created. All symbols (variables) are global, that is, equally accessible inside and outside the module. The symbols referenced inside the module are the same as the symbols outside the module environment. This means that variables created inside the module are also global, and any operations done on variables inside a module affect the global variables as well.

The following example shows a module with no arguments:

   >     /* module without arguments, all symbols are global.  */
   >  proc iml;
   >  a=10;                                /* A is global      */
   >  b=20;                                /* B is global      */
   >  c=30;                                /* C is global      */
   >  start mod1;                          /* begin module     */
   >     p=a+b;                            /* P is global      */
   >     q=b-a;                            /* Q is global      */
   >     c=40;                             /* C already global */
   >  finish;                              /* end module       */

      NOTE: Module MOD1 defined.

   >  run mod1;
   >  print a b c p q;

                      A         B         C         P         Q
                     10        20        40        30        10
Note that after executing the module,

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.