<?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: How to get multiple log files to output using ALTLOG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707195#M217120</link>
    <description>&lt;P&gt;If I have a proc printto within the program I'm calling will that cancel out the main log? My goal is to get a 'Master log' and individual log's for each program.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Dec 2020 18:48:45 GMT</pubDate>
    <dc:creator>SAShole</dc:creator>
    <dc:date>2020-12-19T18:48:45Z</dc:date>
    <item>
      <title>How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/695947#M212469</link>
      <description>&lt;P&gt;I would like to get multiple log files for my program. One overall log file for my 'driver program' that is a master log that captures everything and one for each individual report that is called within the main program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have job that runs on the SAS Scheduler Manager plug-in through SAS MC.&lt;/P&gt;
&lt;P&gt;I've added this to the execute line:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;-altlog /opt/sas/data/sas_reports/scheduler/weekly_report_$(date +%Y-%m-%d_%H%M%S).log&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My 'driver program' calls 40 individual reports like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%include "/opt/sas/data/Prog1.sas";&lt;/P&gt;
&lt;P&gt;%include "/opt/sas/data/Prog2.sas";&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;%include "/opt/sas/data/Prog40.sas";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The individual programs have a similar structure like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc printto&lt;BR /&gt;log="&amp;amp;fname..log" new;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*&lt;/P&gt;
&lt;P&gt;body of the program&lt;/P&gt;
&lt;P&gt;*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc printto;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Details:&lt;/P&gt;
&lt;P&gt;SAS 9.4 on UNIX Grid Servers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to this thread it seems like it should be possible:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/td-p/301336" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/td-p/301336&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42844"&gt;@zekeT_sasaholic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I open my ALTLOG file it stops printing as soon as it hits the proc printto in my first program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 18:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/695947#M212469</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2020-11-02T18:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/695966#M212475</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7900"&gt;@SAShole&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) your login looks like Paul Dorfman's (&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt;&amp;nbsp;) e-mail address &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) why not to make code of programs just:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
body of a program
*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then add this little macro in teh main program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro runMe(program);
filename myLog "/opt/sas/data/sas_reports/scheduler/weekly_report_%sysfunc(datetime(), b8601dt.).log";
proc printto log=myLOG new;
run;
 
%include "/opt/sas/data/&amp;amp;program..sas";

proc printto; run;
data _null_;
  infile myLog;
  input;
  put _infile_;
run;
filename myLog clear;
%mend runMe;



%runMe(Prog1)
%runMe(Prog2)
%runMe(Prog3)&lt;BR /&gt;...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you will get the result you need and you don't have to modify SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/695966#M212475</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-11-02T14:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/704907#M216134</link>
      <description>Hi there. Yikes im kinda late to the game here.  Did you get this to work?  I'll monitor to see whats going on.  Feel free to email me:  info@ztorres.net - so i havent fully seen the write up here or what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35943"&gt;@Bart&lt;/a&gt; has replied (which i'd trust works).  Hence I just wanted to apologize for a late response and see where to help.  Best - z</description>
      <pubDate>Thu, 10 Dec 2020 01:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/704907#M216134</guid>
      <dc:creator>zekeT_sasaholic</dc:creator>
      <dc:date>2020-12-10T01:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707195#M217120</link>
      <description>&lt;P&gt;If I have a proc printto within the program I'm calling will that cancel out the main log? My goal is to get a 'Master log' and individual log's for each program.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2020 18:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707195#M217120</guid>
      <dc:creator>SAShole</dc:creator>
      <dc:date>2020-12-19T18:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707197#M217121</link>
      <description>&lt;P&gt;Run my example and you'll see you have both.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2020 19:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707197#M217121</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-12-19T19:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get multiple log files to output using ALTLOG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707231#M217130</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7900"&gt;@SAShole&lt;/a&gt;&amp;nbsp; - I'm curious to know why you think splitting batch logs is an improvement over a single log per job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are looking for errors it is a whole lot easier to scan one file instead of several. Also since you are using %INCLUDE statements to bring in each program, the program boundaries in the logs are clear if you search on %INCLUDE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then there is the complication of adding and managing ALTLOGs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I follow the KISS (Keep It Simple) principle &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 01:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-multiple-log-files-to-output-using-ALTLOG/m-p/707231#M217130</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-12-20T01:12:43Z</dc:date>
    </item>
  </channel>
</rss>

