<?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: Outputting log to two locations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301340#M63743</link>
    <description>&lt;P&gt;Ok.&lt;/P&gt;
&lt;P&gt;my understanding is that log_a is ok at 100 pct of log or rows has all output.&lt;/P&gt;
&lt;P&gt;but the goal is log_b has only the section you are interested in.&lt;/P&gt;
&lt;P&gt;if that is correct...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;its possible to use "proc printto log="../newfolder/subseta_of_log.log &amp;nbsp;new;"&lt;/P&gt;
&lt;P&gt;the key would be to strategically place this in your code and then -close- that log with a complementary "proc printto log=log; run;" once the section you need is over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note: that this will split up your log into two files (two logs).&lt;/P&gt;
&lt;P&gt;you still need ONE master log (if thats what you want)&lt;/P&gt;
&lt;P&gt;you can do this by specifiying in command line executable or via config the altlog= option mentioned in the other suggestion.&lt;/P&gt;
&lt;P&gt;while you would end up with 3 distinct logs. &amp;nbsp;1 would be the entire log (from altlog) the other two specified from your use of printto.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;zeke torres&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wcsug.com" target="_self"&gt;www.wscug.com&lt;/A&gt;&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;so your code would read:&lt;/P&gt;
&lt;P&gt;/*** top of code nothing run yet***/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc printto log=log; run; *** this is redundant;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.test /* ... (step 1)*/;&lt;/P&gt;
&lt;P&gt;*other code;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=work.test (obs=30);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/** all that will go to regular log **/&lt;/P&gt;
&lt;P&gt;/** now the subset log **/&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc printto log="../newfolder/subseta_of_log.log &amp;nbsp;new; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc /** something else ***/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc print /** something else **/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/** now that you are done - set log back to default **/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc printto log=log; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/*** rest of your code ***/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;endsas;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2016 16:30:37 GMT</pubDate>
    <dc:creator>zekeT_sasaholic</dc:creator>
    <dc:date>2016-09-28T16:30:37Z</dc:date>
    <item>
      <title>Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301336#M63739</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to keep my usual log as is AND&amp;nbsp;output a part of it to another destination (text file) as well. &amp;nbsp;Any suggestions, without running the code over&amp;nbsp;again&amp;nbsp;using a different proc prinnto destination? My normal log is saved so I could also get the info from there but it would be a fair amount of manipulation just to get the bit I need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301336#M63739</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301337#M63740</link>
      <description>&lt;P&gt;Use the ALTLOG= system option, to generate a copy of the log.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301337#M63740</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-28T16:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301338#M63741</link>
      <description>&lt;P&gt;Are you running you program in batch mode or online?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you run as &lt;STRONG&gt;batch&lt;/STRONG&gt; add to the SAS execute line the &lt;STRONG&gt;ALTLOG=&lt;/STRONG&gt; optionn and define the path and log name.&lt;/P&gt;&lt;P&gt;I think it will include also the part written by PROC &lt;STRONG&gt;PRINTTO&lt;/STRONG&gt;, that you mentioned.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301338#M63741</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-09-28T16:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301339#M63742</link>
      <description>&lt;P&gt;Excellent, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301339#M63742</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301340#M63743</link>
      <description>&lt;P&gt;Ok.&lt;/P&gt;
&lt;P&gt;my understanding is that log_a is ok at 100 pct of log or rows has all output.&lt;/P&gt;
&lt;P&gt;but the goal is log_b has only the section you are interested in.&lt;/P&gt;
&lt;P&gt;if that is correct...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;its possible to use "proc printto log="../newfolder/subseta_of_log.log &amp;nbsp;new;"&lt;/P&gt;
&lt;P&gt;the key would be to strategically place this in your code and then -close- that log with a complementary "proc printto log=log; run;" once the section you need is over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;note: that this will split up your log into two files (two logs).&lt;/P&gt;
&lt;P&gt;you still need ONE master log (if thats what you want)&lt;/P&gt;
&lt;P&gt;you can do this by specifiying in command line executable or via config the altlog= option mentioned in the other suggestion.&lt;/P&gt;
&lt;P&gt;while you would end up with 3 distinct logs. &amp;nbsp;1 would be the entire log (from altlog) the other two specified from your use of printto.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;zeke torres&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wcsug.com" target="_self"&gt;www.wscug.com&lt;/A&gt;&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;so your code would read:&lt;/P&gt;
&lt;P&gt;/*** top of code nothing run yet***/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc printto log=log; run; *** this is redundant;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.test /* ... (step 1)*/;&lt;/P&gt;
&lt;P&gt;*other code;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=work.test (obs=30);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/** all that will go to regular log **/&lt;/P&gt;
&lt;P&gt;/** now the subset log **/&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc printto log="../newfolder/subseta_of_log.log &amp;nbsp;new; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc /** something else ***/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc print /** something else **/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/** now that you are done - set log back to default **/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc printto log=log; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/*** rest of your code ***/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;endsas;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:30:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301340#M63743</guid>
      <dc:creator>zekeT_sasaholic</dc:creator>
      <dc:date>2016-09-28T16:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301341#M63744</link>
      <description>&lt;P&gt;Yes, you understood my question correctly. It seems a lot easier to just have the normal log output (so no changes to current proc printto's), then use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* beginning of program *;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;option altlog "destination.log";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* code that generates the log I want an extra copy of *;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;option noaltlog;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* end of program *;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm testing this right now. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301341#M63744</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301343#M63745</link>
      <description>&lt;P&gt;Btw, is this alternate log file going to be appended? &amp;nbsp;I don't want it to be.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301343#M63745</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301344#M63746</link>
      <description>&lt;P&gt;Looks like I can't pop that into the middle of my program:&lt;/P&gt;
&lt;P&gt;WARNING 11-12: SAS option ALTLOG is valid only at startup of the SAS System or startup of a SAS process. The SAS option is ignored.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301344#M63746</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301345#M63747</link>
      <description>&lt;P&gt;that message is correct. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS options have orders of priority or availability to change based on where its being executed.&lt;/P&gt;
&lt;P&gt;The use of this altlog as an "in code" option is limited.&lt;/P&gt;
&lt;P&gt;Altlog is something you might need to do at config or command line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you would need to configure your sas config file.&lt;/P&gt;
&lt;P&gt;for example: im on linux and have a local .sasv9.cfg file.&lt;/P&gt;
&lt;P&gt;in that file i can specify my altlog&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in fact in our location we are currently monitoring some parts of our usage.&lt;/P&gt;
&lt;P&gt;we have a global config option with an altlog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so i know this can work - but your going to have issues if your trying to set that option in the wrong place.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you are running EG - you can still configure your config file - but you would need to find it and create a copy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301345#M63747</guid>
      <dc:creator>zekeT_sasaholic</dc:creator>
      <dc:date>2016-09-28T16:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301347#M63748</link>
      <description>&lt;P&gt;ah - i think i see what you've tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;again - options "in code" can only be set once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my original suggestion still stands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;within your code: use the proc printto - this will allow you to split up your log to the parts you want to keep and part to ignore.&lt;/P&gt;
&lt;P&gt;then outside of your code - use altlog - using the config or command prompt - this will enable you to keep an entire log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hth&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301347#M63748</guid>
      <dc:creator>zekeT_sasaholic</dc:creator>
      <dc:date>2016-09-28T16:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301348#M63749</link>
      <description>&lt;P&gt;Thanks but it looks like the easiest thing in this case is to just get the info I need from the original log. &amp;nbsp;The logs are saved in a standard process for&amp;nbsp;all the programs and I don't want to mess with it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301348#M63749</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T16:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301376#M63764</link>
      <description>&lt;P&gt;If you are confident that your job will not die in the middle part then you could copy the log back to the main log. It will look a little strange,but the information will be there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So first redirect to a file&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log='My new log file.log' new; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then run the steps that you want to have the log information written to that file. &amp;nbsp;THen close it and copy it back into the real log.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log=log; run;

data _null_;
  if _n_=1 or eof then put '****** COPY OF LOG LINES WRITTEN TO SEPARATE FILE ****;
  infile 'My new log file.log' end=eof;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Sep 2016 18:14:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301376#M63764</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-09-28T18:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301381#M63766</link>
      <description>&lt;P&gt;Thanks, interesting to know but too much trouble in this case I think. Or maybe I'm too lazy. &amp;nbsp;My first thought was "I swear these people are conspiring to make my life more difficult" &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 18:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301381#M63766</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-09-28T18:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting log to two locations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301469#M63810</link>
      <description>Why not use OS command COPY or function copy() .</description>
      <pubDate>Thu, 29 Sep 2016 09:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/m-p/301469#M63810</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-29T09:15:48Z</dc:date>
    </item>
  </channel>
</rss>

