Parameter Scope (from Fraktal SAS Programming)
Since scope is the only property of MACRO variables, declaration is easy: Simply assign each variable used to one of these two groups.
However, there is a set of rules requiring your attention:
- A particular variable name may appear in an unlimited number of tables.
- MACROs may be nested to form unlimited invocation hierarchies.
- A calling MACRO’s local table appears global to the called MACRO.
- Read references to variables are performed 1st against the local table.
- Write references are processed likewise: local 1st, global 2nd.
- Write references not met in the invocation hierarchy generate a local variable.
Obviously variable declaration is a critical issue in a validated environment. If not done in total then the validation status of the whole system is questionable.