BookmarkSubscribeRSS Feed
whymath
Lapis Lazuli | Level 10

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.

1.png

 

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!

2.jpg

 

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?

3 REPLIES 3
whymath
Lapis Lazuli | Level 10

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;
Tom
Super User Tom
Super User

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.

Patrick
Opal | Level 21

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

Patrick_0-1699936297198.png

 

Using SAS EG I can't replicate the error you're showing:

Patrick_1-1699936357410.png

 

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();

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 620 views
  • 0 likes
  • 3 in conversation