04-02-2018 06:17 PM - edited 04-06-2018 10:47 AM
Since you can no longer use "." to implicitly reference the current working directory for batch grid jobs, try this:
%global pwd cwd; %macro wd; filename envcmd pipe 'set | egrep "PWD=|LS_SUBCWD="' lrecl=1024; data env; length var $9 val $200; infile envcmd dlm='=' missover; input var $ val $; if val ^= '' then do; if var = 'PWD' then do; pwd = val; put pwd=; call symput('pwd',strip(val)); end; if var = 'LS_SUBCWD' then do; cwd = val; put cwd=; call symput('cwd',strip(val)); end; end; run; %if %superq(cwd) ^= %then %let pwd = &cwd.; %put pwd=&pwd.; libname pwd "&pwd."; libname here "&pwd."; %mend wd; %wd; * End of Macro Include *;
(batch grid launch from command-line with sasgsub)
(batch grid launch from EG with XCMD and sasgsub)
(interactive grid launch from EG)
In the first two cases, we want the value of CWD to overwrite PWD and be captured in a macro-variable for assigning librefs, filerefs, etc. For the third case, it's not really helpful as neither path makes sense for assignment. This is really designed for capturing paths in batch grid jobs where the current working directory changes.
04-06-2018 07:51 AM
In what context do those last two lines work? In another macro somewhere? Or is your entire example meant to be enclosed in a macro?
04-06-2018 10:49 AM
@ChrisHemedinger, I updated my original post that hopefully answers your questions. I'd also be happy to discuss this more at GF.