<?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 timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921318#M362825</link>
    <description>&lt;P&gt;First, are you sure that you want to use 12 of the available 32 characters to name a SAS data set for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And exactly how are you envisioning "proc sql" comes into this? The syntax for naming a data set doesn't change in SQL so I wonder if you have something odd in mind.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 15:30:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-03-21T15:30:19Z</dc:date>
    <item>
      <title>How to include a timestamp in the style YYYYMMDDHHSS in a filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921311#M362820</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a table with the timestamp name Member_YYYYMMDDHHSS using proc sql.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know how to insert that into the table name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 16:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921311#M362820</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-21T16:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921318#M362825</link>
      <description>&lt;P&gt;First, are you sure that you want to use 12 of the available 32 characters to name a SAS data set for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And exactly how are you envisioning "proc sql" comes into this? The syntax for naming a data set doesn't change in SQL so I wonder if you have something odd in mind.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921318#M362825</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-21T15:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921319#M362826</link>
      <description>&lt;P&gt;Hi Ballard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well the table name itself doesn't have to have the timestamp. However the exported table name does.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I have the date format figured out:&lt;/P&gt;&lt;P&gt;%let now=%sysfunc(datetime());&lt;BR /&gt;%let date=%sysfunc(putn(&amp;amp;now,B8601DN8))%sysfunc(timepart(&amp;amp;now),B8601TM6);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when I use this export function, the filename gets exported as Member_&amp;amp;date and not with the actual digits in the name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=Member&lt;BR /&gt;outfile='........../Member_&amp;amp;date..csv'&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I guess I need my proc export function adjusted&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921319#M362826</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-21T15:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921325#M362832</link>
      <description>&lt;P&gt;I suspect you will want to also include 2 digits for the minutes.&lt;/P&gt;
&lt;P&gt;SQL does not have anything to do with this since it just runs the code you give it.&amp;nbsp; You will need to use some code generation.&amp;nbsp; The macro processor is good at that.&lt;/P&gt;
&lt;P&gt;Do you have particular timestamp you want to use? You can use the DATETIME() function to get the current clock time.&amp;nbsp; Use the B8601DT format to make string of digits with the letter T between the date and the time of day parts.&amp;nbsp; If you don't want the T use COMPRESS() to remove it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ts=%sysfunc(compress(%sysfunc(datetime(),b8601dt15.),T));

data want_&amp;amp;ts ;
  set sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921325#M362832</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-21T15:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921326#M362833</link>
      <description>&lt;P&gt;The macro processor does not process string literals that are bounded by single quotes.&lt;/P&gt;
&lt;P&gt;Use double quotes instead if you want the macro processor to act on the value of the string.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921326#M362833</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-21T15:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921329#M362836</link>
      <description>&lt;P&gt;Thanks, changing the single quotes to double got the file to export with the macro properly running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it isn't in the CSV format now. it just exports as "file" Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=Member&lt;BR /&gt;outfile="......../Member_&amp;amp;date"&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921329#M362836</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-21T15:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to timestamp a  tablename with proc sql in the format of YYYYMMDDHHSS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921332#M362837</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/464403"&gt;@aarnold18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks, changing the single quotes to double got the file to export with the macro properly running.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it isn't in the CSV format now. it just exports as "file" Any ideas?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=Member&lt;BR /&gt;outfile="......../Member_&amp;amp;date"&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Huh?&amp;nbsp; If you wrote a CSV file it IS a CSV file.&amp;nbsp; Just look at it with any text editor.&lt;/P&gt;
&lt;P&gt;I suspect you are talking about the fact that you did not NAME the file with an extension of .csv.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;outfile="......../Member_&amp;amp;date..csv"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the extra period.&amp;nbsp; The first one will be used by the macro processor to indicate where the name of the macro variable ends so you need the second one so it will be part of the actual name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS Don't let EXCEL open your CSV without double checking that it hasn't converted character strings to numbers (or worse thought they were date strings) and changed the values.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-include-a-timestamp-in-the-style-YYYYMMDDHHSS-in-a/m-p/921332#M362837</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-21T15:58:53Z</dc:date>
    </item>
  </channel>
</rss>

