Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top