<?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: Need SAS Log when executing Stored Process from MS Excel in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/367088#M5420</link>
    <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2017 18:01:08 GMT</pubDate>
    <dc:creator>Elliott</dc:creator>
    <dc:date>2017-06-14T18:01:08Z</dc:date>
    <item>
      <title>Need SAS Log when executing Stored Process from MS Excel</title>
      <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366749#M5416</link>
      <description>&lt;P&gt;I have a stored process which I run from an excel report. &amp;nbsp;All the sp does is execute a code module which loads data to a table. &amp;nbsp;The sp runs fine but I need to save the log and don't know how to get it to output into the excel I execute from or even place a log somewhere on the unix server. &amp;nbsp;We are running SAS 9.4 on unix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Elliott&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 19:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366749#M5416</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-06-13T19:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS Log when executing Stored Process from MS Excel</title>
      <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366750#M5417</link>
      <description>&lt;P&gt;You can use PROC PRINTTO at the beginning of your STP to send the log file somewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto new log="/somedir/mylog.log";
run;

*main code here;

proc printto; *restore defaults;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't done much with calling stored processes from Excel, but I would think if you want to display it in the Excel, there must me some way to steam the contents back to Excel.&amp;nbsp; Of course not sure I would want to actually SEE a log file viewed in an Excel sheet....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't need a permanent log file, you can send it to work dir with log="%sysfunc(pathname(work))/mylog.log".&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 19:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366750#M5417</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-06-13T19:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS Log when executing Stored Process from MS Excel</title>
      <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366985#M5418</link>
      <description>&lt;P&gt;Thanks Quentin, &amp;nbsp;this is what I need.. is there any way to append a date stamp onto the log name when it outputs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 14:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366985#M5418</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-06-14T14:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS Log when executing Stored Process from MS Excel</title>
      <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366990#M5419</link>
      <description>&lt;P&gt;Yes, you can use the macro language to generate a timestamp, like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(today(),yymmddn8);
20170614

%put %sysfunc(datetime(),b8601dt15);
20170614T104305
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto new log="/somedir/mylog_%sysfunc(datetime(),b8601dt15).log";
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The stored procss&amp;nbsp;server usually has macro variables with name of the stored process, name of the user, etc.&amp;nbsp; So sometimes I will put those into the name of the log file as well.&amp;nbsp; I &amp;nbsp;all the log files for X days, in case someone reports a problem.&amp;nbsp; Having the name of the stored process and the user in the log file makes it easier to find the appropriate log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note some server admins might not like this approach, because if they have configured STP logs to go to a central location, using PROC PRINTTO to redirect the log prevents the log from being written wherever they expect it.&amp;nbsp; If ALTLOG could be executed within a session, I would use that instead.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 14:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/366990#M5419</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-06-14T14:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS Log when executing Stored Process from MS Excel</title>
      <link>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/367088#M5420</link>
      <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Need-SAS-Log-when-executing-Stored-Process-from-MS-Excel/m-p/367088#M5420</guid>
      <dc:creator>Elliott</dc:creator>
      <dc:date>2017-06-14T18:01:08Z</dc:date>
    </item>
  </channel>
</rss>

