1

I've been using a macro library to find and compile my macro codes until recently, where SAS cannot load the macro.

The code I use is:

options mautosource sasautos=MacLib;
filename MacLib "C:\Users\your.name.here\Documents\Macro_Library";

My macro is saved in the file path above as MacroOne.Sas and I try to run a command in SAS

%MacroOne;

For some reason it is just not compiling anymore, any help?

Joe
  • 62,789
  • 6
  • 49
  • 67
78282219
  • 593
  • 5
  • 21
  • On Windows, what you have should work -- I cannot reproduce the problem. Verify the file is in the location. Open the file, run it, then test your macro call. – DomPazz Mar 23 '18 at 16:17
  • It's the wrong way around that is all – 78282219 Mar 23 '18 at 16:57
  • No, it works as he has it on my system. The search for the macro happens at call time, not during the `options` statement. So as long as the filename is set before calling the macro, it will work. – DomPazz Mar 26 '18 at 13:22

1 Answers1

1

It was the wrong way around

filename MacLib "C:\Users\your.name.here\Documents\Macro_Library";
options mautosource sasautos=MacLib;
Joe
  • 62,789
  • 6
  • 49
  • 67
78282219
  • 593
  • 5
  • 21
  • 1
    @Joe You use a FILENAME to point to text files. LIBNAME is for pointing to SAS objects, like datasets and catalogs. For an autocall library you want a filename that points to an aggregate store, aka a directory, so that source code for each macro is contained in its own individual text file. LIBNAME statements can also point to individual files, depending on the engine used. like XPORT or XLSX engines. – Tom Mar 23 '18 at 17:35
  • @Tom Ah, I misread the documentation - thanks for correcting me. Note to SAS: `library-specification` is perhaps not the best language here... – Joe Mar 23 '18 at 18:51
  • The search is done at the first call time. The order doesn't matter as long as both are specified before the macro is used. – DomPazz Mar 26 '18 at 13:24