Christopher Ell
Christopher Ell

Reputation: 2048

Finding Location of SAS Macros

I have been going through SAS code written by others, which references a number of macros in folders around a large corporate network and I don't really know what many of these functions do. Is there a way of locating where SAS is finding the code for an individual function.

So if I put in a macro name for example rather than carrying out the instructions of the macro it would tell my the file path to where the code is located.

Thanks

Upvotes: 3

Views: 2209

Answers (3)

Allan Bowe
Allan Bowe

Reputation: 12691

If you want to figure this out without actually running those macros, you can manually check the locations specified in SASAUTOS via:

%put %sysfunc(getoption(sasautos));

This won't help with %inc's, locally defined (in the program) macros, macros set in the autoexecs, or stored compiled macros.

If you are looking for a way to automatically tell you which directory contains the relevant macro (presuming they are made available via sasautos) you could write a routine that checks each of the above folders using the answer given here as a starter for ten

Upvotes: 0

fl0r3k
fl0r3k

Reputation: 629

  1. You can check if in this code are any %include statements that references external files with macroprograms.
  2. If code is using autocompilationn then setting MAUTOLOCDISPLAY should help to find from where your macro is readed and compiled.
  3. There can be option that your program is calling allready compiled macros. Then opton SASMSTORE points to locations where your macros are compiled.

Upvotes: 3

user667489
user667489

Reputation: 9569

Run option mautolocdisplay; at the top of your code, before you run any macros. This should indicate in the log which autocall folder each one is compiled from.

http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/p04o0tz0t7g88in1mqlh27hj7wgn.htm

This won't help for stored compiled macros or those compiled via %include, but it's a start.

Upvotes: 2

Related Questions