Deleting Macro Variables
Each SAS session has a finite amount of memory allocated to for macro variables. Whilst it is usually plenty; there are other good reasons for removing global macro variables when they are done with from your SAS sessions. For example, if many individual programs are included (see the %include statement) then you should avoid the possibility of a value being reused by another program.
The statement %SYMDEL can be used to delete macro variables from the global symbol statement in SAS. Its syntax is:
%SYMDEL variable-name ; * Create a macro variable via call symputx;
data _null_;
if 0 then set sashelp.class nobs=nobs;
call symputx('no_records',nobs);
stop;
run;
* Create a macro variable via %LET;
%let my_constant = ABC;
* Check they exist (see log file);
%put _user_;
* Clean up;
%symdel no_records my_constant;
* Check they do not exist (see log file);
%put _user_;