<?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 convert these numbers to ISO date?? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360853#M274720</link>
    <description>&lt;P&gt;Thank you very much Chris.. you r awesome..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;what are these numbers 21916 &amp;amp; &lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token number"&gt;86400?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;can I use these numbers for any date? how do you get these numbers.. sorry I am not good in dates conversion. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 May 2017 17:49:04 GMT</pubDate>
    <dc:creator>GreekGod</dc:creator>
    <dc:date>2017-05-23T17:49:04Z</dc:date>
    <item>
      <title>How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360827#M274714</link>
      <description>&lt;P&gt;Hello experts...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have dates like below in an excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;11Nov2014 04:41:32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20Dec2015 17:26:28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28Dec2015 17:26:55&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;21Dec2015 17:28:40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19Apr2015 20:05:38&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10May2014 03:43:47&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I imported this sheet it is converting to a character variable and dates changed like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;41662.26309467592&lt;BR /&gt;41366.85961716435&lt;BR /&gt;41367.70266952546&lt;BR /&gt;41354.89744355325&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to convert these into an ISO date? I read some where that we need to add "00:00" and convert but its not working. Please suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 16:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360827#M274714</guid>
      <dc:creator>GreekGod</dc:creator>
      <dc:date>2017-05-23T16:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360834#M274715</link>
      <description>If you use a data step loader, I would reccomend following the informat with a &amp;amp; symbol which avoids the embedded blank becoming the terminator of the string.&lt;BR /&gt;Providing a default format for the datetime value makes the value meaningful when reported.</description>
      <pubDate>Tue, 23 May 2017 16:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360834#M274715</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-05-23T16:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360840#M274716</link>
      <description>&lt;P&gt;Importing already done, I can't change anything in importing now. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to change these numbers into ISO dates using SAS programming only&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 17:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360840#M274716</guid>
      <dc:creator>GreekGod</dc:creator>
      <dc:date>2017-05-23T17:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360845#M274718</link>
      <description>&lt;P&gt;Assuming the values are character type already, use the INPUT function to convert them to numbers, then some math to convert from Excel datetimes to SAS datetimes. &amp;nbsp;Here's an example with one hardcoded value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
 excel_date = input("41954.195509259",16.9);
 sas_date =  (excel_date - 21916) * 86400;
 format sas_date is8601dt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 2014-11-11T04:41:32&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 17:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360845#M274718</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-05-23T17:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360846#M274719</link>
      <description>&lt;P&gt;1) There are a number ISO formats available. You might want to specify which one you want.&lt;/P&gt;
&lt;P&gt;2) WHY can't you go back to the import step? The specific values as imported look like they have been imported incorrectly as the "date" component I get for those values is 1Jan1960 which usually indicates a datetime that is not correct, especially for the ranges of values you show.&lt;/P&gt;
&lt;P&gt;3) You may have to show how the data was imported to get those values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 17:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360846#M274719</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-23T17:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360853#M274720</link>
      <description>&lt;P&gt;Thank you very much Chris.. you r awesome..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;what are these numbers 21916 &amp;amp; &lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token number"&gt;86400?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token number"&gt;can I use these numbers for any date? how do you get these numbers.. sorry I am not good in dates conversion. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 17:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360853#M274720</guid>
      <dc:creator>GreekGod</dc:creator>
      <dc:date>2017-05-23T17:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360855#M274721</link>
      <description>1. this is the format I need 2014-11-11T04:41:32&lt;BR /&gt;anyway I got it with Chris suggestion..&lt;BR /&gt;2. Its imported by other team and we can't change it since its raw dataset&lt;BR /&gt;3. Its just regular proc import step. formats will messup with proc import.&lt;BR /&gt;anyway thank U for ur reply&lt;BR /&gt;</description>
      <pubDate>Tue, 23 May 2017 17:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360855#M274721</guid>
      <dc:creator>GreekGod</dc:creator>
      <dc:date>2017-05-23T17:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360861#M274722</link>
      <description>&lt;P&gt;It probably helps to explain where those numbers came from.&lt;/P&gt;
&lt;P&gt;SAS stores datetime values in the number of seconds since 1960 and Excel uses days since 1900 with the time part being stored as a fraction of a day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get the days fixed you need to subtract the difference in days between 1960 and 1900 (note that Excel misses one leap day and starts counting from 1 instead of 0). To convert to datetime you need to multiply&amp;nbsp;by the number of seconds in a day to get seconds instead of days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using DATE and TIME literals will make the code clearer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas_date =  int(excel_date - ('01JAN1960'd-'01JAN1900'd+2));
sas_datetime =  (excel_date - ('01JAN1960'd-'01JAN1900'd+2)) * '24:00't;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 18:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360861#M274722</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-23T18:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert these numbers to ISO date??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360873#M274723</link>
      <description>Great thank you Tom for detailed explanation... it helped a lot..</description>
      <pubDate>Tue, 23 May 2017 18:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-these-numbers-to-ISO-date/m-p/360873#M274723</guid>
      <dc:creator>GreekGod</dc:creator>
      <dc:date>2017-05-23T18:27:41Z</dc:date>
    </item>
  </channel>
</rss>

