I created a macro, %READIN, that I use for listing a windows directory and calling in the files for input to a SAS program. The macro works, but when I put it into its own folder and then try to use the SASAUTOS command to bring it in, it cannot find the macro. Here is the code.
Libname CAPMACS 'M:ACXCAP\SAS Macros';
Filename Capmacro catalog 'CAPMACS.autos';
options mautosource mpring symbolgen sasautos;
append = sasautos ('M:\ACXCAP\SAS Macros') ;
%readin;
I get this error;
132 %readin - 180
WARNING: Apparent invocation of macro READIN not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
Can someone help?
Nice you did found the File catalog access method. What that does is allowing SAS catalog members to be treated as being the same like text-files of the OS.
when you do that it should be like: (SAS(R) 9.3 System Options: Reference, Second Edition) and SAS(R) 9.3 Macro Language: Reference (catalog usage)
Libname CAPMACS 'M:ACXCAP\SAS Macros';
Filename Capmacro catalog 'CAPMACS.autos';
options append = ( sasautos = Capmacro ) ;
The requirement will be that you store you macro in the mentioned catalog as source type. There are some options to get data into a catalog, it can be directly accessed using the DMS interface. It looks complicated and it is. The advantages are:
- You can copy catalogs cross-platform without coming into naming problems (eg lowercase Unix)
- You can keep the sources within the structure of the data as catalog-type along the SAS datasets.
More relaxed easy the OS text code approach;
Filename Capmacro 'M:ACXCAP\SAS Macros';
options append = ( sasautos = Capmacro ) ;
The filename I have left there you can use to copy to code/macro there using a datastep or whatever
Hi,
I would try:
I would also try setting options MRECALL while you are debugging this. It tells SAS to look for an autocall macro definition every time you invoke a macro. Without this option, SAS will only look once for each macro.
Assume you are running on Windows. One gotcha on *nix is that the file name of the file holding the macro definition must be lower case.
HTH,
-Q.
You mean this ?
%put %sysfunc(getoption(sasautos));
%put %sysfunc(pathname(sasautos));
Yes , I meant %sysfunc(getoption(sasautos)). Thanks for the correction. I have an autocall macro %getoption() which does something similar, and forgot it was something I wrote.
Nice you did found the File catalog access method. What that does is allowing SAS catalog members to be treated as being the same like text-files of the OS.
when you do that it should be like: (SAS(R) 9.3 System Options: Reference, Second Edition) and SAS(R) 9.3 Macro Language: Reference (catalog usage)
Libname CAPMACS 'M:ACXCAP\SAS Macros';
Filename Capmacro catalog 'CAPMACS.autos';
options append = ( sasautos = Capmacro ) ;
The requirement will be that you store you macro in the mentioned catalog as source type. There are some options to get data into a catalog, it can be directly accessed using the DMS interface. It looks complicated and it is. The advantages are:
- You can copy catalogs cross-platform without coming into naming problems (eg lowercase Unix)
- You can keep the sources within the structure of the data as catalog-type along the SAS datasets.
More relaxed easy the OS text code approach;
Filename Capmacro 'M:ACXCAP\SAS Macros';
options append = ( sasautos = Capmacro ) ;
The filename I have left there you can use to copy to code/macro there using a datastep or whatever
Thank you to everyone that responded. I was able to get the macros to work and the Macro library allocated. Thanks for the assistance.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.