BookmarkSubscribeRSS Feed
suraestar
Calcite | Level 5

macrHi there,

Is there any statement or method to delete a macro in a session?  as like we use SYMDEL for deleting a macro variable.

for instance,

%macro test:

----

-----

%mend test;

Now I would like to kill the test macro from the session.

Many Thanks

Surendar.

4 REPLIES 4
mohamed_zaki
Barite | Level 11

Check this old thread

you can use Proc Catalog

Example:

proc catalog catalog=work;

delete test / et=macro;

quit;

Loko
Barite | Level 11

Hello,

%macro a;
%put y;
%mend a;

proc catalog catalog=work.sasmacr et=macro;
delete a;
run;

KDEdmiston
Fluorite | Level 6

proc catalog catalog = sasmacr;
delete test /et = macro;
run;
quit;

Tom
Super User Tom
Super User

Not sure why this 6 year old thread has been re-activated, but there is now the %SYSMACDELETE macro statement for deleting compiled macros.

Here is a link to a macro that will make it easier to use that statement to delete multiple macros, including preventing you from trying to delete a macro you are currently running.

https://github.com/sasutils/macros/blob/master/macdelete.sas

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4646 views
  • 1 like
  • 5 in conversation