| www.sas.com > SAS UK > In the Know Homepage | Search | Contact Us |
|
|
|
|
How can you ensure the correct values are stored at the time of running your code within your global macro variable symbol table? You can now use the %SYMDEL macro function to delete user-defined macro variables from the global symbol table. Note: The %SYMDEL function works only on GLOBAL macro variables. This is important if your global variables are updated at any point e.g. in a loop. If you need to delete all user-defined macro variables from the global symbol table, then use the following macro. In the example below you will see that a macro variable called mymac1 is set a value of 'Dave'. Once this macro variable has been set, the macro delvars which uses the %symdel function is called. This immediately removes all user-defined global macro variables. To test that the global macro variable &mymac1 has been deleted we've used a %put statement which generates the error. WARNING: Apparent symbolic reference MYMAC1 not resolved, which proves the macro variable no longer exists.
%let mymac1=Dave; NB : This code will run correctly from SAS 8.2 onwards and has been tested on Windows, Unix and the OS/390 operating systems
|