Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine what folder is the SAS macro stored in

Tags:

sas

sas-macro

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?

like image 457
PierreVanStulov Avatar asked Nov 29 '25 06:11

PierreVanStulov


1 Answers

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;
like image 122
Tom Avatar answered Dec 01 '25 17:12

Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!