Since the implicit path "." cannot be used to reference the current working directory for batch grid jobs, this short macro comes to the rescue.
%macro wd;
%local cwd pwd;
%let cwd = %sysget(LS_SUBCWD);
%let pwd = %sysget(PWD);
%if %length(%superq(cwd)) %then %superq(cwd);
%else %superq(pwd);
%mend wd;
The path can then be used anywhere; for example:
libname PWD "%wd";
Check the documentation for more information on the macro function %sysget.
Thank you to @dgritt for providing the original code and agreeing to his contribution being published here.