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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: 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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: 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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 5 replies
  • 917 views
  • 3 likes
  • 4 in conversation