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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
jakarman
Barite | Level 11

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  

---->-- ja karman --<-----

View solution in original post

5 REPLIES 5
Quentin
Super User

Hi,

I would try:

options append=(sasautos="M:\ACXCAP\SAS Macros");

*Take a look at sasautos;
%put %getoption(sasautos);

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.

The Boston Area SAS Users Group is hosting free webinars!

Register now at https://www.basug.org/events.
Ksharp
Super User

You mean this ?

%put %sysfunc(getoption(sasautos));

%put %sysfunc(pathname(sasautos));

Quentin
Super User

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.

The Boston Area SAS Users Group is hosting free webinars!

Register now at https://www.basug.org/events.
jakarman
Barite | Level 11

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  

---->-- ja karman --<-----
LMendoza
Calcite | Level 5

Thank you to everyone that responded.  I was able to get the macros to work and the Macro library allocated.  Thanks for the assistance.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3586 views
  • 3 likes
  • 4 in conversation