<?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: Number of digits for year when using datetime18. format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341240#M78077</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: well, leaving space for parts of seconds could be an explanation for datetime18. (although datetime18. could display the full year, whereas datetime18.1 should display only a 2 digit year)&lt;/P&gt;
&lt;P&gt;If leaving space for parts of seconds is the explanation, then why does datetime19. display a 4 digit year? This leaves only 1 space. So adding parts of second does not fit, because the separator would fill the one space left, so there is no more space for any value.&lt;/P&gt;
&lt;P&gt;datetime19. =&amp;gt; 4 digit year&lt;/P&gt;
&lt;P&gt;datetime19.1 =&amp;gt; 2 digit year&lt;/P&gt;
&lt;P&gt;IMHO datetime18. and datetime18.1 should work exactly like that since&amp;nbsp;I would expect somewhat of a consistent behaviour&amp;nbsp;&lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://communities.sas.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;: yeah that's true. Might be an indication that 2 digit year is sort of hard coded for datetime18. ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2017 15:47:06 GMT</pubDate>
    <dc:creator>mfab</dc:creator>
    <dc:date>2017-03-15T15:47:06Z</dc:date>
    <item>
      <title>Number of digits for year when using datetime18. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341192#M78060</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;perhaps someone knows this gem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the datetime18. format, SAS does display the year with the last two digits only.&lt;/P&gt;
&lt;P&gt;That is even documented over here:&amp;nbsp;&lt;A href="https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0av4h8lmnktm4n1i33et4wyz5yy.htm" target="_blank"&gt;SAS 9.4 Formats and Informats - DATETIMEw.d&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I am wondering why that is. 18 Characters would be enough to display the year with 4 digits and have enough space for all the rest (day, month, time, separators).&lt;/P&gt;
&lt;P&gt;So this: "01JAN2015:00:00:00" could be a perfect datetime18. value, but instead it is this: " &amp;nbsp;01JAN15:00:00:00".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know the reasons behind this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thought was that they might save some space for years greater than 9999, when the year would require 5 digits, but then again, regardless of the datetime width, years greater than 9999 are always displayed as '****'. So this should not be the reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 13:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341192#M78060</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2017-03-15T13:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Number of digits for year when using datetime18. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341203#M78064</link>
      <description>&lt;P&gt;Seems quite clear in that link you give. &amp;nbsp;If its 18. then it is padded with two spaces, this is due to the fact that it leaves room for the seconds optional part.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 14:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341203#M78064</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-15T14:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Number of digits for year when using datetime18. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341214#M78068</link>
      <description>&lt;P&gt;Note that a datetime past year 9999 does display 2 digit years with datetime18. but not 5 digits&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x = '10MAR15021'd;
   y  = dhms(x,0,0,0);
   put y datetime18. y datetime20. y datetime22. y datetime32.;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 14:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341214#M78068</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-15T14:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Number of digits for year when using datetime18. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341240#M78077</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: well, leaving space for parts of seconds could be an explanation for datetime18. (although datetime18. could display the full year, whereas datetime18.1 should display only a 2 digit year)&lt;/P&gt;
&lt;P&gt;If leaving space for parts of seconds is the explanation, then why does datetime19. display a 4 digit year? This leaves only 1 space. So adding parts of second does not fit, because the separator would fill the one space left, so there is no more space for any value.&lt;/P&gt;
&lt;P&gt;datetime19. =&amp;gt; 4 digit year&lt;/P&gt;
&lt;P&gt;datetime19.1 =&amp;gt; 2 digit year&lt;/P&gt;
&lt;P&gt;IMHO datetime18. and datetime18.1 should work exactly like that since&amp;nbsp;I would expect somewhat of a consistent behaviour&amp;nbsp;&lt;img id="smileyfrustrated" class="emoticon emoticon-smileyfrustrated" src="https://communities.sas.com/i/smilies/16x16_smiley-frustrated.png" alt="Smiley Frustrated" title="Smiley Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;: yeah that's true. Might be an indication that 2 digit year is sort of hard coded for datetime18. ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341240#M78077</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2017-03-15T15:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Number of digits for year when using datetime18. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341284#M78088</link>
      <description>&lt;P&gt;Proc format with the Picture date/time directives will let you roll your own datetime format. Here is an example of 18 character with 4 digit year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
picture mydatetime ( default=18)
low-high = "%d%b%Y:%H:%M:%S"   (datatype=datetime)
;
run;

data _null_;
   x='15Feb2017:10:12:13'dt;
   put x mydatetime. x datetime18.;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 18:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Number-of-digits-for-year-when-using-datetime18-format/m-p/341284#M78088</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-15T18:17:24Z</dc:date>
    </item>
  </channel>
</rss>

