2017-04-14 37 views
3

存儲的SAS宏是什麼文件夾我有一個程序(它是由我的同事開發的)在SASAUTOS中有20個路徑。所以,當我看到在代碼中調用某個宏時,我無法輕易確定宏存儲在哪個文件夾中。是否有用於此目的的某個函數或系統表具有可用於當前SAS中的宏名稱和物理路徑會議?如何確定存儲在

回答

7

當您運行代碼時,有兩個系統選項可以提供幫助。

AUTOCOMPLOC將在編譯自動調用宏時在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爲你找到它。製作一個指向與SASAUTOS設置相同的文件夾的聚合fileref。

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

然後使用一個簡單的INFILE語句來查找特定文件的路徑。

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

非常感謝,湯姆! – PierreVanStulov

相關問題