如何确定SAS宏存储在哪个文件夹中
How to determine what folder is the SAS macro stored in
我有一个程序(它是由我的同事开发的)在 SASAUTOS 中有 20 个路径。因此,当我看到在代码中调用某个宏时,我无法轻易确定宏存储在哪个文件夹中。是否有一些用于此目的的函数或系统 table 具有宏的名称和物理路径可以是在当前 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.4\core\sasmacro\left.sas.
MAUTOLOCDISPLAY(LEFT): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\left.sas
MAUTOCOMPLOC: The autocall macro VERIFY is compiling using the autocall source file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\verify.sas.
MAUTOLOCDISPLAY(VERIFY): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.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.4\core\sasmacro\left.sas
MAUTOLOCDISPLAY(VERIFY): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\verify.sas
如果您只想找出特定文件的位置,那么您可以尝试让 SAS 为您找到它。制作一个指向与您的 SASAUTOS 设置相同的文件夹的聚合文件引用。
filename xx ('path1' 'path2' 'path3') ;
然后使用简单的 INFILE 语句查找特定文件的路径。
data _null_;
length fname 0;
infile xx('mymacro.sas') filename=fname;
input;
put fname= ;
stop;
run;
我有一个程序(它是由我的同事开发的)在 SASAUTOS 中有 20 个路径。因此,当我看到在代码中调用某个宏时,我无法轻易确定宏存储在哪个文件夹中。是否有一些用于此目的的函数或系统 table 具有宏的名称和物理路径可以是在当前 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.4\core\sasmacro\left.sas.
MAUTOLOCDISPLAY(LEFT): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\left.sas
MAUTOCOMPLOC: The autocall macro VERIFY is compiling using the autocall source file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\verify.sas.
MAUTOLOCDISPLAY(VERIFY): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.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.4\core\sasmacro\left.sas
MAUTOLOCDISPLAY(VERIFY): This macro was compiled from the autocall file C:\Program
Files\SASHome\SASFoundation.4\core\sasmacro\verify.sas
如果您只想找出特定文件的位置,那么您可以尝试让 SAS 为您找到它。制作一个指向与您的 SASAUTOS 设置相同的文件夹的聚合文件引用。
filename xx ('path1' 'path2' 'path3') ;
然后使用简单的 INFILE 语句查找特定文件的路径。
data _null_;
length fname 0;
infile xx('mymacro.sas') filename=fname;
input;
put fname= ;
stop;
run;