%sysfunc(getoption(sysin))
will provide you the full path name of the program that is run in batch mode. At least it does so on AIX with SAS 9.4.
A full step to extract the path without the program name looks like this:
data _null_;
length path path2 $200;
path = getoption('sysin');
do i = 1 to countw(path,'/') - 1;
path2 = cat(strip(path2),'/'!!scan(path,i,'/'));
end;
put path2=;
run;
... View more