Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

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);
* 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_;