Skip to content
Prev 165219 / 398506 Next

understanding lexical scope

Well, SAS macros are not functions in the traditional sense.  The SAS macro language for the most part just does text substitution prior to the SAS code being sent to the SAS "compiler"/interpreter. So, your description of rewriting the "function body" in step 1. below, is fairly accurate for SAS macro, but it is not accurate for R.  If you try to fit R functions into a SAS macro language mold you will only confuse yourself on both accounts.  I will leave the technical details of R functions to the R experts.
If you want to try to compare the R language to SAS language (not favorable to SAS for most on this list), the better comparison for understanding is the data step language, not SAS macro.
I bet one of the expeRts on the list will provide you with more detail than could have ever hoped for.

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204