<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS Tip: Obtain the current working directory with batch grid jobs on UNIX/Linux in SAS Tips from the Community</title>
    <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Obtain-the-current-working-directory-with-batch-grid/m-p/455472#M163</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since&amp;nbsp;the implicit path "." cannot be used to reference the current working directory for batch grid jobs, this short macro comes to the rescue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The path can then be used anywhere; for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname PWD "%wd";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the documentation for more information on the macro function &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p14ppks96uz65an1l5uq3elm0m3y.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%sysget&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Thank you to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44881"&gt;@dgritt&lt;/a&gt;&amp;nbsp;for providing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Helpful-macro-to-obtain-current-working-directory-with-batch/m-p/451919" target="_self"&gt;original&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;code and agreeing to his contribution being published here.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2024 04:14:25 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2024-06-24T04:14:25Z</dc:date>
    <item>
      <title>SAS Tip: Obtain the current working directory with batch grid jobs on UNIX/Linux</title>
      <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Obtain-the-current-working-directory-with-batch-grid/m-p/455472#M163</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since&amp;nbsp;the implicit path "." cannot be used to reference the current working directory for batch grid jobs, this short macro comes to the rescue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The path can then be used anywhere; for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname PWD "%wd";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the documentation for more information on the macro function &lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p14ppks96uz65an1l5uq3elm0m3y.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%sysget&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Thank you to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44881"&gt;@dgritt&lt;/a&gt;&amp;nbsp;for providing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Helpful-macro-to-obtain-current-working-directory-with-batch/m-p/451919" target="_self"&gt;original&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;code and agreeing to his contribution being published here.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 04:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Obtain-the-current-working-directory-with-batch-grid/m-p/455472#M163</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-06-24T04:14:25Z</dc:date>
    </item>
  </channel>
</rss>

