What is the difference between %LOCAL and %GLOBAL?
Copy/paste the exact words below into a Google search:
sas What is the difference between %LOCAL and %GLOBAL
Also search for macro variable scope.
They both are used to make sure macro variables are defined. The difference is where they are defined. %GLOBAL will define them in the global symbol table. %LOCAL will define them in the symbol table for the currently running macro. Once the current macro finishes running its symbol table disappears.
% Local is a macro variable defined inside a macro. %Global is a macro variable defined in open code (outside the macro or can use anywhere).
Incorrect. local or global indicates the scope of the macro variable. You can create global macros within a macro for instance. The default for macro variables created within a macro is local to the macro, however you can explicitly state the macro variable is global, and hence make it available outside. As that doesn't really work with encapsulation, so default is local.
There is clear guidance in the documentation about this:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.