<?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 Running SAS Program in Batch Mode as Scheduled Task in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Running-SAS-Program-in-Batch-Mode-as-Scheduled-Task/m-p/549944#M152660</link>
    <description>&lt;P&gt;I have created a batch (.bat) file to run my SAS 9.4 program. When I manually run the batch file, the program runs perfectly fine. However, when I schedule the batch file to run using the windows task scheduler, the program doesn't run properly. It seems to get hung up when I start to use relative paths in my libname statements.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the piece of my SAS code that is having trouble when run as a scheduled task:&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;data _NULL_;
      %let Prog = %sysfunc(getoption(sysin));
run;

proc sql noprint;
      select tranwrd(xpath,"\&amp;amp;prog","") into :source
      from dictionary.extfiles
      where index(xpath,"&amp;amp;prog") &amp;gt; 0;
quit;


X "cd &amp;amp;source";

libname Derived "..\Datasets";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the SAS program or the batch file manually, the relative paths work great. But for some reason when the batch file is run as a scheduled task, I get a note in the log saying "Library DERIVED does not exist." Does anyone know why the relative paths aren't working when run as a scheduled task? I'd really prefer not to have to change every relative path to absolute paths if possible.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Apr 2019 13:27:33 GMT</pubDate>
    <dc:creator>arielsomers</dc:creator>
    <dc:date>2019-04-10T13:27:33Z</dc:date>
    <item>
      <title>Running SAS Program in Batch Mode as Scheduled Task</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-SAS-Program-in-Batch-Mode-as-Scheduled-Task/m-p/549944#M152660</link>
      <description>&lt;P&gt;I have created a batch (.bat) file to run my SAS 9.4 program. When I manually run the batch file, the program runs perfectly fine. However, when I schedule the batch file to run using the windows task scheduler, the program doesn't run properly. It seems to get hung up when I start to use relative paths in my libname statements.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the piece of my SAS code that is having trouble when run as a scheduled task:&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;data _NULL_;
      %let Prog = %sysfunc(getoption(sysin));
run;

proc sql noprint;
      select tranwrd(xpath,"\&amp;amp;prog","") into :source
      from dictionary.extfiles
      where index(xpath,"&amp;amp;prog") &amp;gt; 0;
quit;


X "cd &amp;amp;source";

libname Derived "..\Datasets";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the SAS program or the batch file manually, the relative paths work great. But for some reason when the batch file is run as a scheduled task, I get a note in the log saying "Library DERIVED does not exist." Does anyone know why the relative paths aren't working when run as a scheduled task? I'd really prefer not to have to change every relative path to absolute paths if possible.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 13:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-SAS-Program-in-Batch-Mode-as-Scheduled-Task/m-p/549944#M152660</guid>
      <dc:creator>arielsomers</dc:creator>
      <dc:date>2019-04-10T13:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Running SAS Program in Batch Mode as Scheduled Task</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-SAS-Program-in-Batch-Mode-as-Scheduled-Task/m-p/549960#M152668</link>
      <description>&lt;P&gt;Your "desktop" environment differs subtly from your "batch" environment (current working directory). Therefore always use absolute pathnames.&lt;/P&gt;
&lt;P&gt;The same is true for other platforms (UNIX etc)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 13:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-SAS-Program-in-Batch-Mode-as-Scheduled-Task/m-p/549960#M152668</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-10T13:52:35Z</dc:date>
    </item>
  </channel>
</rss>

