/* Gets path for the SAS-program being executed */
%macro GetSASProgramPath;
%qsubstr(%sysget(SAS_
%mend;
%let SASProgramPath = %GetSASProgramPath;
This will only work on Windows.
In batchmode you can get the programname with the code below. This will work in eg an AIX environment.
%let ProgramName = %sysfunc(getoption(sysin));
%put &ProgramName;