How to determine which folder is a SAS macro stored in

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

+3


source to share


1 answer


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

MAUTOCOMPLOC

will display the location of the source of the macro MAUTOCOMPLOC

in the SAS log when MAUTOCOMPLOC

automatic MAUTOCOMPLOC

.

MAUTOLOCDISPLAY

will display the location of the source of the macro MAUTOLOCDISPLAY

in the log.

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 find out where a particular file is located, you can ask SAS to find it for you. Create a 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 to a specific file.

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

      

+7


source







All Articles