<?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 Re: Batch processing much slower than interactive session in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791836#M253693</link>
    <description>&lt;P&gt;Should I check something for these beyond the options output?&lt;/P&gt;
&lt;P&gt;Both batch and interactive mode options have:&lt;BR /&gt;UTILLOC=WORK&lt;/P&gt;
&lt;P&gt;And the WORK is set to my local temp files (C:\Users\username~1\AppData\Local\Temp\SAS Temporary Files\_TDxxxx_)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jan 2022 12:59:44 GMT</pubDate>
    <dc:creator>MB_Analyst</dc:creator>
    <dc:date>2022-01-24T12:59:44Z</dc:date>
    <item>
      <title>Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791830#M253689</link>
      <description>&lt;P&gt;I have syntax that, when run in batch mode, is significantly slower than in an interactive session. I checked the output of proc options;run; and I'm not seeing any major differences. Steps that often bog down in batch mode are anything I/O, or proc sort. For example, the following code snippets takes a less than 3 minutes each during an interactive session, and 10+ minutes each in batch. Although the real time increases to around 10 minutes, the CPU time remains around ~5 seconds.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Example sql pull from server location */&lt;BR /&gt;proc sql;
    create table want as
    select
    a.*,
    b.*
    from have1 a
    left join have2 b
    on a.id = b.id
    order by a.id, a.date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;/*&amp;nbsp;example&amp;nbsp;data&amp;nbsp;step&amp;nbsp;with&amp;nbsp;work&amp;nbsp;library&amp;nbsp;*/
data&amp;nbsp;want2;
    set want(where=(id&amp;nbsp;ne&amp;nbsp;.));
    by&amp;nbsp;id&amp;nbsp;date;
    if&amp;nbsp;first.id&amp;nbsp;then&amp;nbsp;output;
run;&lt;/PRE&gt;
&lt;P&gt;My guess is the difference could be due to a number of things, but wondering if anyone had thoughts on options to check? The code runs daily, and I plan to add FULLSTIMER to get a better sense of bottlenecks. Any ideas why batch would be double+ the time to run?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit to add in a difference in CONFIG locations:&lt;/P&gt;
&lt;P&gt;Batch CONFIG:&lt;/P&gt;
&lt;PRE&gt;CONFIG=( "C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg" "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" )&lt;/PRE&gt;
&lt;P&gt;Interactive CONFIG:&lt;/P&gt;
&lt;PRE&gt;CONFIG=C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 13:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791830#M253689</guid>
      <dc:creator>MB_Analyst</dc:creator>
      <dc:date>2022-01-24T13:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791834#M253691</link>
      <description>&lt;P&gt;Look at the setup of your WORK and UTILLOC in both environments; also post logs from both environments here after you activated FULLSTIMER.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 12:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791834#M253691</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-24T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791835#M253692</link>
      <description>Do you have LOG of batch mode ? Like *.log &lt;BR /&gt;&lt;BR /&gt;"D:\SASHome\SASFoundation\9.4\sas.exe" -nosplash -sysin "c:\temp\temp.sas" -log "c:\temp\temp#Y#m#d-#H-#M-#s.log" -logparm "rollover=auto" -set dsn "sashelp.air" -set age "'01jan1955'd" &lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jan 2022 12:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791835#M253692</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-24T12:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791836#M253693</link>
      <description>&lt;P&gt;Should I check something for these beyond the options output?&lt;/P&gt;
&lt;P&gt;Both batch and interactive mode options have:&lt;BR /&gt;UTILLOC=WORK&lt;/P&gt;
&lt;P&gt;And the WORK is set to my local temp files (C:\Users\username~1\AppData\Local\Temp\SAS Temporary Files\_TDxxxx_)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 12:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791836#M253693</guid>
      <dc:creator>MB_Analyst</dc:creator>
      <dc:date>2022-01-24T12:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791837#M253694</link>
      <description>&lt;P&gt;I do have the log being output. A scheduled task runs a "master file" that outputs in one location, and runs %include statements to run other code. The %include statements use proc printto to output individual .log files for each syntax file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bat file consists of the following:&lt;/P&gt;
&lt;PRE&gt;"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -SYSIN "C:\path\to\master\masterCode.sas" -log "C:\path\to\logs\%DATESTAMP%_masterLog.log" -noprint&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 13:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791837#M253694</guid>
      <dc:creator>MB_Analyst</dc:creator>
      <dc:date>2022-01-24T13:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791838#M253695</link>
      <description>Then check your LOG file and could find out which part of code is the most wasting time .</description>
      <pubDate>Mon, 24 Jan 2022 13:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791838#M253695</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-24T13:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791861#M253706</link>
      <description>&lt;P&gt;Then it may well be that your background (batch) processes have a lower priority than your foreground (interactive) ones. This makes sense on a desktop.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 14:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791861#M253706</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-24T14:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791862#M253707</link>
      <description>&lt;P&gt;Compare the CPU times between the two runs instead of just the REAL times.&amp;nbsp; It could just be that the job is running with lower priority or when the machine is busier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you running multiple SAS sessions at the same time?&amp;nbsp; If they are all using the same disk for WORK then there will be a lot of disk contention in addition to needing to share the CPU.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note if you are going to be running multiple SAS sessions are the same time then make sure to use the RSASUSER option when you start SAS.&amp;nbsp; &amp;nbsp;This will open the SASUSER libref in readonly mode.&amp;nbsp; Then when you try to open a new interactive SAS session while another SAS session is running you still get access to your personalized settings, like window locations and key mappings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 14:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791862#M253707</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-24T14:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Batch processing much slower than interactive session</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791898#M253721</link>
      <description>&lt;P&gt;I will look into this. It could be promising because if I run the .bat manually (i.e. double clicking), it runs much faster than when the schedule tasks prompts the .bat.&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;I will change the priority based on this &lt;A href="https://aavtech.site/2018/01/windows-task-scheduler-changing-task-priority/" target="_self"&gt;webpage's info&lt;/A&gt;, as I confirmed SAS is set at a lower priority when run from a batch file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 16:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Batch-processing-much-slower-than-interactive-session/m-p/791898#M253721</guid>
      <dc:creator>MB_Analyst</dc:creator>
      <dc:date>2022-01-24T16:43:40Z</dc:date>
    </item>
  </channel>
</rss>

