- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.