<?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: SAS Date in YYYYMMDDHHMMSS format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773702#M245822</link>
    <description>Date will look like 20211012134021</description>
    <pubDate>Tue, 12 Oct 2021 17:45:00 GMT</pubDate>
    <dc:creator>DeepakSwain</dc:creator>
    <dc:date>2021-10-12T17:45:00Z</dc:date>
    <item>
      <title>SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773699#M245819</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your kind help to get system date in YYYYMMDDHHMMSS format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
export_date=put(datetime(), datetime20.);
put export_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773699#M245819</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2021-10-12T17:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773700#M245820</link>
      <description>&lt;P&gt;Is this close enough:&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;data _null_;
  export_date=put(datetime(), E8601DT.);
  put export_date;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0z62k899n6a7wn1r5in6q5253v1.htm" target="_self"&gt;Dictionary of Formats&lt;/A&gt; for a list of formats&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773700#M245820</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-10-12T17:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773701#M245821</link>
      <description>&lt;P&gt;How about&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
export_date=put(datetime(), B8601DT.);
put export_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773701#M245821</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-10-12T17:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773702#M245822</link>
      <description>Date will look like 20211012134021</description>
      <pubDate>Tue, 12 Oct 2021 17:45:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773702#M245822</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2021-10-12T17:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773703#M245823</link>
      <description>&lt;P&gt;I don't think there is a format that is exactly YYYYMMDDHHMMSS, this comes close:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data null;
export_date=datetime();
format export_date b8601dt20.0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that isn't close enough, the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/p0n990vq8gxca6n1vnsracr6jp2c.htm" target="_self"&gt;PICTURE statement&lt;/A&gt; in PROC FORMAT allows you to create your own &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/p1717ykol58oijn13lw9rs30lhn0.htm" target="_self"&gt;custom date/time formats&lt;/A&gt; that will match exactly.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773703#M245823</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-12T17:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773705#M245825</link>
      <description>e8601dt20. will return 2021-10-21T13:46:07.&lt;BR /&gt;I want 20211021134607.</description>
      <pubDate>Tue, 12 Oct 2021 17:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773705#M245825</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2021-10-12T17:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773706#M245826</link>
      <description>&lt;P&gt;If you want an exact match, you can roll out your own format like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
  picture dtfmt (default=30)
    other = '%Y%0m%0d%0H%0M%0S' (datatype=datetime)
  ;
run;

data _null_;
  export_date=put(datetime(), dtfmt.);
  put export_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773706#M245826</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-10-12T17:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773707#M245827</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/38137"&gt;@DeepakSwain&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Date will look like 20211012134021&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Requires custom format:&lt;/P&gt;
&lt;PRE&gt;proc format;
picture mydatetime
low-high='%Y%0m%0d%0H%0M%0S' (datatype=datetime)
;
run;

data example;
   x='12Oct2021:13:40:21'dt;
   put x= mydatetime.;
run;&lt;/PRE&gt;
&lt;P&gt;The directives in the Picture statement are case sensitive, the m is month, M is minutes mix them up and don't expect to understand any result. Also this is one place that you really need to use single quotes around the directives for the format, otherwise the directives get interpreted as macro calls and will throw errors. It will be up to you to make sure that the format is available in any session than needs to use this.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773707#M245827</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-12T17:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date in YYYYMMDDHHMMSS format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773708#M245828</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;Great minds think alike &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 18:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-in-YYYYMMDDHHMMSS-format/m-p/773708#M245828</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-10-12T18:00:55Z</dc:date>
    </item>
  </channel>
</rss>

