<?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: Reading sas log file dynamically in  batch mode in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436439#M282165</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134796"&gt;@Deepti44&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;yes it written to &amp;amp; logdir.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting below&amp;nbsp; ERROR when i execute in batch mode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: At least one file associated with fileref MYLOG is still in use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a way i can read log dynamiccay while execution in batch mode.&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is because SAS still has the log open to write to. You might investigate Proc Printto with the log option to write the log up to the point you want to read it.&lt;/P&gt;
&lt;P&gt;Proc printto log='&amp;lt;log file name and location goes here&amp;gt;';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;lt;other code generating log entries&amp;gt;&lt;/P&gt;
&lt;P&gt;/* this ends sending to that specific log file*/&lt;/P&gt;
&lt;P&gt;Proc printo;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Then the data step to generate your report but read the file on the Printo statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 20:23:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-02-12T20:23:19Z</dc:date>
    <item>
      <title>Reading sas log file dynamically in  batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436277#M282162</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im trying to read log file " dynamically " in batch mode(see below code) , but coudnt able to determine the ERRORS.when i run the same below code via sas EG front end it can able to determine the ERRORS. any idea what is going wron in batch mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*EXTRACT ERRORS FROM LOG FILE AND SEND EMAIL */&lt;/P&gt;&lt;P&gt;data my_log;&lt;BR /&gt;infile "&amp;amp;LOGDIR." truncover;&lt;BR /&gt;input a_line $200.;&lt;BR /&gt;if index(a_line, 'ERROR:') &amp;gt;0&lt;BR /&gt;/*or*/&lt;BR /&gt;/*index(a_line, 'WARNING') &amp;gt; 0*/&lt;BR /&gt;then output;&lt;BR /&gt;/**/&lt;BR /&gt;/*if index(a_line, 'ERROR:') &amp;gt; 0 */&lt;BR /&gt;/*then abort 255;*/&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436277#M282162</guid>
      <dc:creator>Deepti44</dc:creator>
      <dc:date>2018-02-12T16:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading sas log file dynamically in  batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436290#M282163</link>
      <description>&lt;P&gt;Is the log file for match mode actually written to "&amp;amp;logdir"? Batch mode may well write the log to a different location depending on how the batch program is started. Check the parameters of the batch program that starts the job.&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;</description>
      <pubDate>Mon, 12 Feb 2018 17:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436290#M282163</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-12T17:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reading sas log file dynamically in  batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436295#M282164</link>
      <description>&lt;P&gt;yes it written to &amp;amp; logdir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting below&amp;nbsp; ERROR when i execute in batch mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: At least one file associated with fileref MYLOG is still in use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way i can read log dynamiccay while execution in batch mode.&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;</description>
      <pubDate>Mon, 12 Feb 2018 18:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436295#M282164</guid>
      <dc:creator>Deepti44</dc:creator>
      <dc:date>2018-02-12T18:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading sas log file dynamically in  batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436439#M282165</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134796"&gt;@Deepti44&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;yes it written to &amp;amp; logdir.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting below&amp;nbsp; ERROR when i execute in batch mode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: At least one file associated with fileref MYLOG is still in use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a way i can read log dynamiccay while execution in batch mode.&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;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is because SAS still has the log open to write to. You might investigate Proc Printto with the log option to write the log up to the point you want to read it.&lt;/P&gt;
&lt;P&gt;Proc printto log='&amp;lt;log file name and location goes here&amp;gt;';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;lt;other code generating log entries&amp;gt;&lt;/P&gt;
&lt;P&gt;/* this ends sending to that specific log file*/&lt;/P&gt;
&lt;P&gt;Proc printo;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Then the data step to generate your report but read the file on the Printo statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 20:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436439#M282165</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-12T20:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading sas log file dynamically in  batch mode</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436560#M282166</link>
      <description>&lt;P&gt;Why are you trying to capture a batch job's warnings and errors while it is still running? Even if you can find a way to do it, you won't be able to capture all of them until the job has completed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I find it a lot easier to use the scheduler's functionality to automatically send an email if the job return code is not zero. Any warning or error in the SAS log will trigger a non-zero return code so you don't need to read&amp;nbsp;the log at all.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 03:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-sas-log-file-dynamically-in-batch-mode/m-p/436560#M282166</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-02-13T03:47:23Z</dc:date>
    </item>
  </channel>
</rss>

