<?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: PROC PRINTTO log truncated in background execution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984295#M379687</link>
    <description>&lt;P&gt;I think I would start by looking for the code for the OPTIONS statement that is turning off notes and source:&lt;/P&gt;
&lt;PRE&gt;8927 options nonotes nosource nosyntaxcheck;&lt;/PRE&gt;
&lt;P&gt;Is that the last thing you see in the log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that options statement coming from your macro? User-written code? Is it being automatically generated by Studio?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's definitely possible for a macro to turn off logging and forget to turn it back on at the end.&amp;nbsp; But I can't think why that would only happen with a background submit.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2026 22:33:46 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2026-03-02T22:33:46Z</dc:date>
    <item>
      <title>PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984286#M379686</link>
      <description>&lt;P data-end="401" data-start="387"&gt;Hi everyone,&lt;/P&gt;
&lt;P data-end="479" data-start="408"&gt;I'm using &lt;STRONG data-end="476" data-start="418"&gt;SAS Studio&amp;nbsp;Release: 3.81 (Enterprise Edition).&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-end="479" data-start="408"&gt;A colleague of mine is experiencing an issue related to log redirection in a long-running program executed in background. We have a main program (&lt;STRONG&gt;pgm1&lt;/STRONG&gt;) that includes another program (&lt;STRONG&gt;pgm2&lt;/STRONG&gt;) using:&lt;/P&gt;
&lt;P data-end="479" data-start="408"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*pgm1*/
%include "pgm2.sas";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-end="835" data-start="734"&gt;The original code is for internal use, so the example below is a simplified replica of the structure.&lt;/P&gt;
&lt;P data-end="892" data-start="842"&gt;In&lt;STRONG&gt; pgm2&lt;/STRONG&gt;, the log is redirected using PROC PRINTTO:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log="xxxxxx\log_file.txt" new;
run;

data test1;
  a=1;
run;

data test2;
  a=1;
run;

%macro p();
  data test3;
    a=1;
  run;
%mend p;

%p();

data test4; 
  c=1; 
run; 

data test5; 
  p=1; 
run; 

proc printto; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-end="1252" data-start="1208"&gt;The full code runs for approximately 5 hours and the behavior differs depending on how the program is executed:&lt;/P&gt;
&lt;UL data-end="1520" data-start="1328"&gt;
&lt;LI data-end="1446" data-start="1328"&gt;
&lt;P data-end="1446" data-start="1330"&gt;when executed normally (not in background), the log file is created correctly and contains all the expected content;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-end="1516" data-start="1449"&gt;
&lt;P data-end="1516" data-start="1451"&gt;when executed in background mode, the log file appears truncated.&amp;nbsp;&lt;SPAN&gt;Specifically, the first data steps (test1 and test2) are correctly written to the log file, but starting from the macro execution (%p()) no additional log content appears in the redirected log file.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-end="1756" data-start="1728"&gt;We would like to understand:&lt;/P&gt;
&lt;UL data-end="2036" data-start="1759"&gt;
&lt;LI data-end="1824" data-start="1759"&gt;
&lt;P data-end="1824" data-start="1761"&gt;whether this could be related to background execution handling;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-end="1919" data-start="1827"&gt;
&lt;P data-end="1919" data-start="1829"&gt;if there are known buffering or flushing differences with PROC PRINTTO in background mode;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-end="2032" data-start="1922"&gt;
&lt;P data-end="2032" data-start="1924"&gt;whether macro execution might interact differently with log redirection in long-running background sessions.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-end="2178" data-start="2039"&gt;Additionally, we are not using any system options like NONOTES or NOSYMBOLGEN&amp;nbsp;in the code&lt;/P&gt;
&lt;P data-end="1117" data-start="1027"&gt;and we see unusual log messages when running in background, such as:&lt;/P&gt;
&lt;UL data-end="1300" data-start="1120"&gt;
&lt;LI data-end="1158" data-start="1120"&gt;
&lt;P data-end="1158" data-start="1122"&gt;&lt;CODE data-end="1156" data-start="1122"&gt;NOTE: %INCLUDE (level 1) ending.&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-end="1217" data-start="1161"&gt;
&lt;P data-end="1217" data-start="1163"&gt;&lt;CODE data-end="1215" data-start="1163"&gt;8927       options nonotes nosource nosyntaxcheck;&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-end="1296" data-start="1220"&gt;
&lt;P data-end="1296" data-start="1222"&gt;&lt;CODE data-end="1294" data-start="1222"&gt;SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE;&lt;/CODE&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-end="2178" data-start="2039"&gt;Has anyone experienced similar behavior or can suggest a more robust approach for managing log redirection in long-running background programs?&lt;/P&gt;
&lt;P data-end="2178" data-start="2039"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-end="2178" data-start="2039"&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2026 20:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984286#M379686</guid>
      <dc:creator>Gauss212</dc:creator>
      <dc:date>2026-03-02T20:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984295#M379687</link>
      <description>&lt;P&gt;I think I would start by looking for the code for the OPTIONS statement that is turning off notes and source:&lt;/P&gt;
&lt;PRE&gt;8927 options nonotes nosource nosyntaxcheck;&lt;/PRE&gt;
&lt;P&gt;Is that the last thing you see in the log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that options statement coming from your macro? User-written code? Is it being automatically generated by Studio?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's definitely possible for a macro to turn off logging and forget to turn it back on at the end.&amp;nbsp; But I can't think why that would only happen with a background submit.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2026 22:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984295#M379687</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-03-02T22:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984297#M379688</link>
      <description>&lt;P&gt;Do you have any other indications that the SAS code is actively running?&amp;nbsp; Perhaps the program has crashed (or gone into an infinite loop) and that is why nothing is being written to the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try changing startup options that writes to the log are flushed to the disk immediately.&amp;nbsp; That might allow you to see what is the last step that is actually running.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-force-updates-to-SAS-Log/td-p/413993" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-force-updates-to-SAS-Log/td-p/413993&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also with "background" execution I would assume that means it is running the job directly from the .sas file (instead of having code submitted by your front end tool such as SAS Display Manager or Enterprise Guide or SAS/Studio).&amp;nbsp; In which case the lengths of the lines in the .sas file might be an issue.&amp;nbsp; If a line gets truncated you might end up with unclosed quotes for example that might make the program hang.&amp;nbsp; Personally I try to make sure that no lines of code in the .sas file is longer then the 65-70 character limit that humans can read without moving their eyes side to side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2026 23:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984297#M379688</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-03-02T23:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984312#M379691</link>
      <description>&lt;P data-end="252" data-start="83"&gt;Nowhere in the code are these options (&lt;CODE data-end="154" data-start="122"&gt;NONOTES NOSOURCE NOSYNTAXCHECK&lt;/CODE&gt;) present. They have never been inserted in the main program, the macros, or the included files.&lt;/P&gt;
&lt;P data-end="252" data-start="83"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-end="537" data-start="254"&gt;If you know, is it possible that, since the job runs for several hours and is executed in the background, SAS automatically disables some log options, causing the log file to be incomplete? If so, would it be useful to insert &lt;CODE data-end="366" data-start="350"&gt;options notes;&lt;/CODE&gt; at strategic points to force the log to be written?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2026 11:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984312#M379691</guid>
      <dc:creator>Gauss212</dc:creator>
      <dc:date>2026-03-03T11:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984313#M379692</link>
      <description>&lt;P data-end="302" data-start="113"&gt;So, you’re saying that even lines longer than 70 characters could cause errors in background execution? That’s strange, because when not running in background the log is created normally.&lt;/P&gt;
&lt;P data-end="302" data-start="113"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-end="442" data-start="304"&gt;To investigate further, I could try using &lt;CODE data-end="367" data-start="346"&gt;options fullstimer;&lt;/CODE&gt;, but in any case, the final outputs are still being generated correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2026 11:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984313#M379692</guid>
      <dc:creator>Gauss212</dc:creator>
      <dc:date>2026-03-03T11:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINTTO log truncated in background execution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984317#M379693</link>
      <description>&lt;P&gt;LInes longer than 70 will only cause problems for humans reading the code which could lead to unbalanced quotes, etc that they do not see.&amp;nbsp; But that is probably not your problem if the same code runs properly in other situations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lines longer than whatever default LRECL SAS uses to read the codef ile from SYSIN could cause problems.&amp;nbsp; But you state the program actually runs and only the log file is missing.&amp;nbsp; So that is probably not your problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are other things to check.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Is there some system process that is removing files from the location where PROC PRINTTO writes the file.&lt;/LI&gt;
&lt;LI&gt;Are you sure you are looking at the file that PROC PRINTTO is writing to?&amp;nbsp; Perhaps some difference in the execution environment is causing it to place that file somewhere else.&lt;/LI&gt;
&lt;LI&gt;Are you running multiple versions of the program at the same time?&amp;nbsp; If so then make sure that they are not all trying to write to the same LOG file.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 03 Mar 2026 14:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINTTO-log-truncated-in-background-execution/m-p/984317#M379693</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-03-03T14:18:12Z</dc:date>
    </item>
  </channel>
</rss>

