I'm trying to rename a SAS catalog, this catalog is used to store macros and I have used "SASMSTORE=" option to change that. Well, there is an error message: This catalog is in use in DMS process.
So I start to write some test until really weird thing happend. I write "%i_am_not_exist()" before PROC DATASETS, the log report an error that this macro not resloved, but the renaming program successes!
One more troubling detail: File size of this catalog changes from 5 kb to 21 kb(I see this from SAS File Explorer), why?
How do you think of that?
The test code:
libname cus "C:\Profiles\Work";
options mstored sasmstore=cus;
%macro a()/store;
%put I am placeholder;
%mend;
option sasmstore=sasuser;
%i_am_not_exist();
proc datasets nolist lib=cus memtype=catalog;
change Sasmacr=forms ;
quit;
Is the catalog used as the location that SAS will look for compiled macros?
If you probably need to first disable that, probably by pointing somewhere else.
But why do you have compiled macros at all? Using them just causes trouble, as you have discovered.
That SAS continues processing even after throwing an error due to a non existing macro is just how SAS works.
Add options errorabend if you want SAS to always stop processing (well... terminate the SAS session actually) if it encounters an error.
options errorabend;
libname cus "C:\temp\Work";
options mstored sasmstore=cus;
%macro a()/store;
%put I am placeholder;
%mend;
option sasmstore=sasuser;
%i_am_not_exist();
proc datasets nolist lib=cus memtype=catalog;
change Sasmacr=forms ;
run;
quit;
/* clean-up to allow for re-run */
proc datasets lib=cus kill;
run;quit;
When running your code without option errorabend then that's what I'm getting
Using SAS EG I can't replicate the error you're showing:
I also can't replicate this file size growth from 5 to 21KB. In my environment the catalog is and remains 21KB from start.
And same question as Tom: Why would you want to pre-compile your macros at all? Why not just store them in a folder that's part of your SAS Autocall facility.
Just store the macro definition for macro a under C:\temp\Work\a.sas
You then can add the folder at the beginning of the macro search path using syntax as below:
options insert=(sasautos="C:\temp\Work");
%a();
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.