Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clearing a library which is being used for stored compiled SAS macro

Tags:

sas

sas-macro

I have a program which creates a stored compiled macro in a library using the syntax:

options mstored sasmstore=MyLib; 
%macro MyMac() /store source des='My Macro'; 
  %let x=1;
%mend;

However I cannot seem to re-assign my library (MyLib) afterwards - I get the following message (sas 9.1.3):

ERROR: Unable to clear or re-assign the library MYLIB because it is still in use.
ERROR: Error in the LIBNAME statement.

Can anyone advise?

like image 642
Allan Bowe Avatar asked Nov 24 '25 09:11

Allan Bowe


2 Answers

In SAS 9.3 or higher, you can now clear the libref using the %SYSMSTORECLEAR Statement.

like image 176
SAS Jedi Avatar answered Nov 28 '25 03:11

SAS Jedi


Short answer - I don't think you can in the same SAS session.

You can't clear the libref because the macro catalog (SASMACR) remains open. It stays open since it takes resources to open and close the catalog and SAS assumes that compiled macros are going for speed in production jobs and as a trade-off, lose some dynamic abilities. All resources have to be closed before you can clear the libref. Since SASMACR remains in use (and short of closing the session doesn't appear to be a way to close it), ther is no way to clear the libref.

like image 31
cmjohns Avatar answered Nov 28 '25 02:11

cmjohns



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!