tags:

views:

239

answers:

1

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?

+3  A: 

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.

cmjohns