DATA Step, Macro, Functions and more

Help in allocating a macro library.

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Help in allocating a macro library.

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?


Accepted Solutions
Solution
‎04-13-2015 01:58 PM
Valued Guide
Posts: 3,208

Re: Help in allocating a macro library.

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


All Replies
PROC Star
Posts: 1,230

Re: Help in allocating a macro library.

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.

Super User
Posts: 9,676

Re: Help in allocating a macro library.

You mean this ?

%put %sysfunc(getoption(sasautos));

%put %sysfunc(pathname(sasautos));

PROC Star
Posts: 1,230

Re: Help in allocating a macro library.

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.

Solution
‎04-13-2015 01:58 PM
Valued Guide
Posts: 3,208

Re: Help in allocating a macro library.

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 --<-----
New Contributor
Posts: 2

Re: Help in allocating a macro library.

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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