How to Delete Macro Variables in SAS?2 min read

To delete SAS macro variables, you can use the %SYMDEL statement or the CALL SYMDEL routine.

%SYMDEL and CALL SYMDEL is a data step call routine that is used to delete macro variables from the global symbol table.

How to Delete a single macro variable?

You can use both methods to delete a macro variable.

Delete a macro variable with the CALL SYMDEL  Routine

To delete a macro variable using the CALL SYMDEL, use the macro variable name within quotes in the Call routine.


CALL SYMDEL(macro-variable<, option>);


%let mvar = xyz;
data _null_;
	call symdel('mvar');

Note that CALL SYMDEL issues a warning when an attempt is made to delete a non-existent macro variable. To suppress this message, use the NOWARN option. call symdel('mvar')

Delete a macro variable with the %SYMDEL Macro Statement

The %SYMDEL routine deletes the specified variable from the macro global symbol table.


%SYMDEL variable-name ;

%SYMDEL statement gives a warning when an attempt is made to delete a non-existent macro variable. To suppress this warning in the log, you can use the NOWARN option.

%symdel variable-name / nowarn;


%let mname = ABC;
%put &mname;
%symdel mname;
%put &mname

Key Takeaway

So, this is the way you can delete macro variables in SAS. We really hope that you must have found it useful.

Moreover, if you have any other suggestions regarding other tips or tricks to add then suggest us below the comment section. We would really take those lists in our further blog post.

Thanks for reading!

If you liked this article, you might also want to read CALL SYMPUT in SAS and Creating macro variables from the SAS dataset as well.

Do you have any tips to add Let us know in the comments?

Please subscribe to our mailing list for weekly updates. You can also find us on Instagram and Facebook.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
Scroll to Top