<?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: Naming an output file with date and time in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311342#M1949</link>
    <description>&lt;P&gt;My favorite for creating control variables is to do it in a data step and use call symput:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symput('cdate',put(date(),ddmmyyn8.));
timestr = put(time(),tod5.);
call symput('ctime',substr(timestr,1,2)!!substr(timestr,4,2));
run;
%put &amp;amp;cdate.;
%put &amp;amp;ctime.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the tod. format outputs a leading zero for single-digit hours (what the time. format does not do).&lt;/P&gt;
&lt;P&gt;In a data step I can hack away using simple data step syntax without having to repeatedly use %sysfunc or %eval.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2016 08:19:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-11-14T08:19:03Z</dc:date>
    <item>
      <title>Naming an output file with date and time</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311288#M1947</link>
      <description>&lt;P&gt;Within SAS Enterprise Guide i've set up a automated process to export an excel file to a file.&lt;/P&gt;&lt;P&gt;At the moment it replaces it's self every time the query runs. However i don't wish it to do&amp;nbsp;this, i would like it if it was a new file every time and was named to show the date and time the file exported for auditing reasons.&lt;/P&gt;&lt;P&gt;an example of what i would like is...&lt;/P&gt;&lt;P&gt;File13112016_1000&lt;/P&gt;&lt;P&gt;File13112016_1300&lt;/P&gt;&lt;P&gt;File13112016_1500&lt;/P&gt;&lt;P&gt;File13112016_1700&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any help you could provide. I love SAS as it really helps my role but i don't use it enough to understand it as well as i know you guys do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Vic&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2016 22:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311288#M1947</guid>
      <dc:creator>VicBrookes</dc:creator>
      <dc:date>2016-11-13T22:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Naming an output file with date and time</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311297#M1948</link>
      <description>&lt;P&gt;How are you controlling the name of the output file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create two macro variables that hold the date and time in the respective formats and then use them in the name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;file_name = "name&amp;amp;date._&amp;amp;time";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cdate=%sysfunc(today(), ddmmyyn8.);
%put &amp;amp;cdate.;

*this isnt correct format, you need to find the one that doesnt have colons;
%let ctime=%sysfunc(time(), time4.));
%put &amp;amp;ctime.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 00:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311297#M1948</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-14T00:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Naming an output file with date and time</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311342#M1949</link>
      <description>&lt;P&gt;My favorite for creating control variables is to do it in a data step and use call symput:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symput('cdate',put(date(),ddmmyyn8.));
timestr = put(time(),tod5.);
call symput('ctime',substr(timestr,1,2)!!substr(timestr,4,2));
run;
%put &amp;amp;cdate.;
%put &amp;amp;ctime.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the tod. format outputs a leading zero for single-digit hours (what the time. format does not do).&lt;/P&gt;
&lt;P&gt;In a data step I can hack away using simple data step syntax without having to repeatedly use %sysfunc or %eval.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 08:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Naming-an-output-file-with-date-and-time/m-p/311342#M1949</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-14T08:19:03Z</dc:date>
    </item>
  </channel>
</rss>

