PierreVanStulov
PierreVanStulov

Reputation: 425

How to determine what folder is the SAS macro stored in

I have a program (it was developed by my colleagues) with 20 paths in SASAUTOS. So, when I see calling of some macro in the code I can't easily determine what folder the macro is stored in. Is there some function for this purpose or system table with names and physical paths to macroes which can be used in current SAS session?

Upvotes: 3

Views: 1514

Answers (1)

Tom
Tom

Reputation: 51621

There are two system options that can help when you run the code.

MAUTOCOMPLOC will display the autocall macro source location in the SAS log when the autocall macro is compiled.

MAUTOLOCDISPLAY will display the autocall macro source location in the log when the macro is run.

388  options mautolocdisplay mautocomploc;
389  %let x=%left(x);
MAUTOCOMPLOC:  The autocall macro LEFT is compiling using the autocall source file C:\Program
            Files\SASHome\SASFoundation\9.4\core\sasmacro\left.sas.
MAUTOLOCDISPLAY(LEFT):  This macro was compiled from the autocall file C:\Program
                        Files\SASHome\SASFoundation\9.4\core\sasmacro\left.sas
MAUTOCOMPLOC:  The autocall macro VERIFY is compiling using the autocall source file C:\Program
            Files\SASHome\SASFoundation\9.4\core\sasmacro\verify.sas.
MAUTOLOCDISPLAY(VERIFY):  This macro was compiled from the autocall file C:\Program
                          Files\SASHome\SASFoundation\9.4\core\sasmacro\verify.sas
390  %let x=%left(x);
MAUTOLOCDISPLAY(LEFT):  This macro was compiled from the autocall file C:\Program
                        Files\SASHome\SASFoundation\9.4\core\sasmacro\left.sas
MAUTOLOCDISPLAY(VERIFY):  This macro was compiled from the autocall file C:\Program
                          Files\SASHome\SASFoundation\9.4\core\sasmacro\verify.sas

If you just want to figure out where a particular file is then you can try asking SAS to find it for you. Make an aggregate fileref that points to the same folders as your SASAUTOS settings.

filename xx ('path1' 'path2' 'path3') ;

Then use a simple INFILE statement to find the path of a particular file.

data _null_;
  length fname $500;
  infile xx('mymacro.sas') filename=fname;
  input;
  put fname= ;
  stop;
run;

Upvotes: 7

Related Questions