Wednesday, April 13, 2011

Delete all global macro variables

To delete all global user macro variables where you don’t have to specify the variable names, a pair of data steps can be used to delete all variables found:

data macvars; /* build ds for mac vars */
set sashelp.vmacro; /* names in dict table */
where scope='GLOBAL'; /* only keep globals */
run; /* end of step */

data _null_; /* another step */
set macvars; /* read above, and delete*/
call execute('%symdel '!!trim(left(name))!!';');
run; /* end of step */

No comments: