BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
madara155
Obsidian | Level 7

Hi

I am trying to delete all the macro variables in a program and can't seem to find a method.

Saw that some people have suggested to use %SYMDEL but I don't know how to delete all the macro variables using it.

 

Can someone please help me?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

First, you have to realize that what you requested is not possible.  You can only delete GLOBAL macro variables,  You cannot delete LOCAL macro variables, and you cannot delete AUTOMATIC macro variables that are supplied by the software.  So if deleting GLOBAL macro variables will satisfy what you need to do, here is a link that shows you how:

 

https://www.lexjansen.com/nesug/nesug06/po/po06.pdf

 

The specific example you requested begins at the bottom of page 3.

View solution in original post

4 REPLIES 4
AlanC
Barite | Level 11

Use the following options at the top of the program:

 

options mfile mprint obs=0 noerrorbyabend errors=0 source source2 nonotes;

filename mprint 'c:\temp\SasCode.txt’;

 

When you run your program, a new copy of it will be in the SasCode.txt file with all macros resolved.

https://github.com/savian-net
Astounding
PROC Star

First, you have to realize that what you requested is not possible.  You can only delete GLOBAL macro variables,  You cannot delete LOCAL macro variables, and you cannot delete AUTOMATIC macro variables that are supplied by the software.  So if deleting GLOBAL macro variables will satisfy what you need to do, here is a link that shows you how:

 

https://www.lexjansen.com/nesug/nesug06/po/po06.pdf

 

The specific example you requested begins at the bottom of page 3.

madara155
Obsidian | Level 7

Thanks.

I only wanted to delete the global macro variables I defined.

Regards.

Ksharp
Super User

Use this code to get all the macro variables .and %symdel them all.

 

proc sql;
create table x as
select * from dictionary.macros;
quit;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3732 views
  • 1 like
  • 4 in conversation