Symdel in SAS1 min read

CALL SYMDEL Data Step Call Routine

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

Syntax

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

Example:

%let mvar = xyz;
   data _null_;
      mvarName = 'mvar';
      call symdel(mvarName, 'nowarn');
   run;

Note:  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.

WARNING: Attempt to delete macro variable MNAME failed. Variable not found.</p>Enter your text here...

%SYMDEL Macro Statement

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

Syntax

%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;

Example

%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 suggestion regarding other tips or tricks to add then suggest us below the comment section. We would really take those list 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 SAS dataset as well.

Do you 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.

Leave a Comment

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

Share via
Copy link