如何确定SAS宏存储在哪个文件夹中

如何确定SAS宏存储在哪个文件夹中,sas,sas-macro,Sas,Sas Macro,我有一个程序(由我的同事开发),在SASAAutos中有20条路径。因此,当我在代码中看到调用某个宏时,我无法轻松确定宏存储在哪个文件夹中。是否有用于此目的的函数或系统表,其中包含可在当前SAS会话中使用的宏的名称和物理路径?有两个系统选项可在运行代码时提供帮助 编译自动调用宏时,MAUTOCOMPLOC将在SAS日志中显示自动调用宏源位置 MAUTOLOCDISPLAY运行宏时,将在日志中显示自动调用宏源位置 388 options mautolocdisplay mautocomploc;

我有一个程序(由我的同事开发),在SASAAutos中有20条路径。因此,当我在代码中看到调用某个宏时,我无法轻松确定宏存储在哪个文件夹中。是否有用于此目的的函数或系统表,其中包含可在当前SAS会话中使用的宏的名称和物理路径?

有两个系统选项可在运行代码时提供帮助

编译自动调用宏时,
MAUTOCOMPLOC
将在SAS日志中显示自动调用宏源位置

MAUTOLOCDISPLAY
运行宏时,将在日志中显示自动调用宏源位置

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
如果您只是想知道某个特定文件的位置,那么您可以尝试让SAS为您查找该文件。创建一个聚合fileref,该聚合fileref指向与SASAUTOS设置相同的文件夹

filename xx ('path1' 'path2' 'path3') ;
然后使用简单的infle语句查找特定文件的路径

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

非常感谢,汤姆!