BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
THALLA_REDDY
Obsidian | Level 7

Hello Community,

 

Can anyone let me know the error in below code,

I am trying to create a compile source and store it on the permanent library with below code

 

LIBNAME mylib '/home/sasapp1/macrlib';

options mstored sasmstored=mylib;

%macro date / store source des='Define filenames';

filename file1 '/home/sasapp1/macrlib/date.sas';

%mend;

RUN;

 

I am not getting any compiled code created on the mentioned path.

 

My SAS EG is running on UNIX server

 

thanks in Advance,

Thalla

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Remove those last two options lines as they are changing the options you wanted to set.

 

If you want to use the directory as the place to find define.sas or date.sas then use either the physical path in SASAUTOS

options sasautos=('/home/thallareddy/sasmacr' sasautos);

or create a fileref that points to that folder and use the fileref in the option setting. Make sure that you don't have a typo in the fileref.

filename macrolib '/home/thallareddy/sasmacr';
options sasautos=(macrolib sasautos);

To test if the macro definition is actually there try compiling it explicitly by using %INCLUDE.

%include macrolib('define.sas');
%define;

If that works then you can remove the %INCLUDE statement.

 

 

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

Does your actual code have the typo?

74    options mstored sasmstored=mylib;
                      ----------
                      13

ERROR 13-12: Unrecognized SAS option name SASMSTORED.

Why would you want to create a compiled macro catalog?  Why not just store the macro definitions into text files (where you can look at them with a many different tools) and use SASAUTOS facility instead?

Kurt_Bremser
Super User

Do NOT store your macros in catalogs, unless you want to lose the code. Catalogs are version- and operating system-dependent, and when you realize that you can't open a catalog file, it's already too late.

ALWAYS store macros as text in .sas files; use the Autocall Facility if you want the macros to be automatically loaded when used in code.

THALLA_REDDY
Obsidian | Level 7

thanks for your reply,
Now I changed my code to use SASAUOS as below,
LIBNAME macrolib '/home/thallareddy/sasmacr';

OPTIONS MSTORED SASMSTORE=macrolib;

 

OPTIONS MAUTOSTORE SASAUTOS=('/home/thallareddy/sasmacr/DEFINE.sas',sasautos);

OPTIONS MAUTOSTORE SASAUTOS=('/home/thallareddy/sasmacr/DATE.sas',sasautos);

 

%DEFINE;

%DATE;

 

//*From here my actual program will starts and it should get the variables &CURRDATE, &M_BEG_DT....etc resolved using the above macros. *//

But when I am trying to run this program I am getting the error log as :

"Note:The SAS system was unable to open the macro library referenced by the SASMSTORE = libref datemacr.

Warning: Apparent invocation of macro DEFINED not resolved"

Can you help to find where I am not doing good.

 

thanks,

thalla reddy

Tom
Super User Tom
Super User

The advice was to use autocall, NOT stored compiled macros.

So make the following changes:

1) Turn OFF the MSTORED option.

2) Point the SASAUTOS option to the directory with the macro definitions.

OPTIONS NOMSTORED MRECALL SASAUTOS=('/home/thallareddy/sasmacr/');

3) Store the macro definitions in files with LOWERCASE names.

So the %DEFINE macro would be in a file named /home/thallareddy/sasmacr/define.sas

 

THALLA_REDDY
Obsidian | Level 7

I followed steps as you mentioned and the code is:

LIBNAME macrolib '/home/thallareddy/sasmacr';

OPTIONS NOMSTORED MRECALL SASAUTOS=(MACLIB,sasautos);

 

OPTIONS MAUTOSTORE SASAUTOS=('/home/thallareddy/sasmacr/define.sas',sasautos);

OPTIONS MAUTOSTORE SASAUTOS=('/home/thallareddy/sasmacr/date.sas',sasautos);

 

%DEFINE;

%DATE;

Still I am getting the same error, "Apparent invocation of Macro define is not resolved"

Can you please help me on this....

 

thanks,

thalla

Tom
Super User Tom
Super User

Remove those last two options lines as they are changing the options you wanted to set.

 

If you want to use the directory as the place to find define.sas or date.sas then use either the physical path in SASAUTOS

options sasautos=('/home/thallareddy/sasmacr' sasautos);

or create a fileref that points to that folder and use the fileref in the option setting. Make sure that you don't have a typo in the fileref.

filename macrolib '/home/thallareddy/sasmacr';
options sasautos=(macrolib sasautos);

To test if the macro definition is actually there try compiling it explicitly by using %INCLUDE.

%include macrolib('define.sas');
%define;

If that works then you can remove the %INCLUDE statement.

 

 

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!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1145 views
  • 3 likes
  • 3 in conversation