<?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 Question about datetimes and precision in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-datetimes-and-precision/m-p/76070#M16413</link>
    <description>Can someone explain where the highest precision numbers in variables d4 to d7 came from?&lt;BR /&gt;
&lt;BR /&gt;
The SAS program:&lt;BR /&gt;
&lt;BR /&gt;
data foo;         &lt;BR /&gt;
    format d1-d7 datetime30.6; &lt;BR /&gt;
    timestring = "23:59:59.997000000"; &lt;BR /&gt;
    time = input(timestring,time18.); &lt;BR /&gt;
    d1 = dhms(0,0,0,time); &lt;BR /&gt;
    d2 = dhms('08DEC1981'd,0,0,time); &lt;BR /&gt;
    d3 = dhms('31DEC2503'd,0,0,time); &lt;BR /&gt;
    d4 = dhms('31DEC2504'd,0,0,time); &lt;BR /&gt;
    d5 = dhms('08DEC2981'd,0,0,time); &lt;BR /&gt;
    d6 = dhms('08DEC4981'd,0,0,time); &lt;BR /&gt;
    d7 = dhms('08DEC9999'd,0,0,time); &lt;BR /&gt;
run; &lt;BR /&gt;
proc print;run;&lt;BR /&gt;
&lt;BR /&gt;
The output:&lt;BR /&gt;
&lt;BR /&gt;
Obs                             d1                             d2                             d3 &lt;BR /&gt;
&lt;BR /&gt;
  1       01JAN1960:23:59:59.997000      08DEC1981:23:59:59.997000      31DEC2503:23:59:59.997000 &lt;BR /&gt;
&lt;BR /&gt;
 Obs                             d4                             d5                             d6 &lt;BR /&gt;
&lt;BR /&gt;
  1       31DEC2504:23:59:59.997002      08DEC2981:23:59:59.997002      08DEC4981:23:59:59.996994 &lt;BR /&gt;
&lt;BR /&gt;
 Obs                             d7        timestring          time &lt;BR /&gt;
&lt;BR /&gt;
  1       08DEC9999:23:59:59.997009    23:59:59.997000000    86400.00</description>
    <pubDate>Sat, 17 Oct 2009 12:44:10 GMT</pubDate>
    <dc:creator>MichielBorkent</dc:creator>
    <dc:date>2009-10-17T12:44:10Z</dc:date>
    <item>
      <title>Question about datetimes and precision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-datetimes-and-precision/m-p/76070#M16413</link>
      <description>Can someone explain where the highest precision numbers in variables d4 to d7 came from?&lt;BR /&gt;
&lt;BR /&gt;
The SAS program:&lt;BR /&gt;
&lt;BR /&gt;
data foo;         &lt;BR /&gt;
    format d1-d7 datetime30.6; &lt;BR /&gt;
    timestring = "23:59:59.997000000"; &lt;BR /&gt;
    time = input(timestring,time18.); &lt;BR /&gt;
    d1 = dhms(0,0,0,time); &lt;BR /&gt;
    d2 = dhms('08DEC1981'd,0,0,time); &lt;BR /&gt;
    d3 = dhms('31DEC2503'd,0,0,time); &lt;BR /&gt;
    d4 = dhms('31DEC2504'd,0,0,time); &lt;BR /&gt;
    d5 = dhms('08DEC2981'd,0,0,time); &lt;BR /&gt;
    d6 = dhms('08DEC4981'd,0,0,time); &lt;BR /&gt;
    d7 = dhms('08DEC9999'd,0,0,time); &lt;BR /&gt;
run; &lt;BR /&gt;
proc print;run;&lt;BR /&gt;
&lt;BR /&gt;
The output:&lt;BR /&gt;
&lt;BR /&gt;
Obs                             d1                             d2                             d3 &lt;BR /&gt;
&lt;BR /&gt;
  1       01JAN1960:23:59:59.997000      08DEC1981:23:59:59.997000      31DEC2503:23:59:59.997000 &lt;BR /&gt;
&lt;BR /&gt;
 Obs                             d4                             d5                             d6 &lt;BR /&gt;
&lt;BR /&gt;
  1       31DEC2504:23:59:59.997002      08DEC2981:23:59:59.997002      08DEC4981:23:59:59.996994 &lt;BR /&gt;
&lt;BR /&gt;
 Obs                             d7        timestring          time &lt;BR /&gt;
&lt;BR /&gt;
  1       08DEC9999:23:59:59.997009    23:59:59.997000000    86400.00</description>
      <pubDate>Sat, 17 Oct 2009 12:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-datetimes-and-precision/m-p/76070#M16413</guid>
      <dc:creator>MichielBorkent</dc:creator>
      <dc:date>2009-10-17T12:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question about datetimes and precision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-datetimes-and-precision/m-p/76071#M16414</link>
      <description>You can do this by using the BEST. format -- also, the LENGTH statement has influence on granularity, as where the FORMAT statement influences the output format being displayed.  As well, the higher the date, the larger integer portion of the SAS variable occurs.  Also, the SAS OS platform has some influence.  Suggested links for reading provided below.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 Language Reference: Concepts - Numeric Precision in SAS Software:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000695157.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000695157.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 Language Reference: Concepts - About SAS Date, Time, and Datetime Values&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Step-by-Step Programming with Base SAS(R) Software - Working with Numeric Variables:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304311.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304311.htm&lt;/A&gt;</description>
      <pubDate>Sat, 17 Oct 2009 15:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-datetimes-and-precision/m-p/76071#M16414</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-10-17T15:55:20Z</dc:date>
    </item>
  </channel>
</rss>

