<?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: Reading dates from excel to SAS environment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664988#M198750</link>
    <description>&lt;P&gt;You need to take the offset difference between Excel (actually, Lotus 1-2-3) and SAS into account. Change your statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_dt = dt + '30dec1899'd;
format new_dt yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;as I guess that dt is actually numeric. If not, keep the input():&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_dt = input(dt,best.) + '30dec1899'd;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 Jun 2020 12:37:01 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-06-25T12:37:01Z</dc:date>
    <item>
      <title>Reading dates from excel to SAS environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664984#M198746</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;
&lt;P&gt;I HAVE AN EXCEL SHEET WHICH I'M IMPORTING IN TO SAS ENVIRONMENT. in excel, i have a column where the dates have been displayed as&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="142"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="142"&gt;28-Oct-17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;14-Jan-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2-Feb-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;13-Jan-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;29-Jan-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12-May-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1-Jun-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;28-Aug-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;19-Jun-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10-Jul-18&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I'm reading in to sas environment. it gives output as and it is a character column&lt;/P&gt;
&lt;P&gt;43072&lt;BR /&gt;43097&lt;BR /&gt;43124&lt;BR /&gt;43142&lt;BR /&gt;43076&lt;BR /&gt;43097&lt;BR /&gt;43146&lt;BR /&gt;43100&lt;BR /&gt;43184&lt;BR /&gt;43106&lt;/P&gt;
&lt;P&gt;I want the values to be displayed as yymmdd format in sas.&lt;/P&gt;
&lt;P&gt;When i CONVERT this column it gives wrong values. Such as for above mentioned sas dates values are displayed as 2077-12-04&lt;BR /&gt;2077-12-29&lt;BR /&gt;2078-01-25&lt;BR /&gt;2078-02-12&lt;BR /&gt;2077-12-08&lt;BR /&gt;2077-12-29&lt;BR /&gt;2078-02-16&lt;BR /&gt;2078-01-01&lt;BR /&gt;2078-03-26&lt;BR /&gt;2078-01-07&lt;/P&gt;
&lt;P&gt;the code I'm using is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_dt=input(dt,best9.);format new_dt yymmdd10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know how should i do to get the right values as posted above( the way it is displayed in the excel).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 12:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664984#M198746</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-06-25T12:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dates from excel to SAS environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664988#M198750</link>
      <description>&lt;P&gt;You need to take the offset difference between Excel (actually, Lotus 1-2-3) and SAS into account. Change your statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_dt = dt + '30dec1899'd;
format new_dt yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;as I guess that dt is actually numeric. If not, keep the input():&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_dt = input(dt,best.) + '30dec1899'd;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jun 2020 12:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664988#M198750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-25T12:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dates from excel to SAS environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664996#M198755</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you very much for your kind attention.The coulmn is in character. requesting you to let me know the reason behind using 30dec1899,would like to know more about it.&lt;BR /&gt;The output is not coming right, Please have a look to the output i just got and help me know more with your suggestions.&lt;BR /&gt;2017-12-03&lt;BR /&gt;2017-12-28&lt;BR /&gt;2018-01-24&lt;BR /&gt;2018-02-11&lt;BR /&gt;2017-12-07&lt;BR /&gt;2017-12-28&lt;BR /&gt;2018-02-15&lt;BR /&gt;2017-12-31&lt;BR /&gt;2018-03-25&lt;BR /&gt;2018-01-06&lt;BR /&gt;where as the right output would be &lt;BR /&gt;28-Oct-2017&lt;BR /&gt;14-Jan-2018&lt;BR /&gt;2-Feb-2018&lt;BR /&gt;13-Jan-2018&lt;BR /&gt;29-Jan-2018&lt;BR /&gt;12-May-2018&lt;BR /&gt;1-Jun-2018&lt;BR /&gt;28-Aug-2018&lt;BR /&gt;19-Jun-2018&lt;BR /&gt;10-Jul-2018&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Jun 2020 13:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/664996#M198755</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-06-25T13:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dates from excel to SAS environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/665004#M198759</link>
      <description>&lt;P&gt;43072 &lt;STRONG&gt;IS&lt;/STRONG&gt; 2017-12-03 in Excel. Enter the number in Excel and format it as a date.&lt;/P&gt;
&lt;P&gt;And in SAS, the conversion works:&lt;/P&gt;
&lt;PRE&gt; 73         data _null_;
 74         date = 43072 + '30dec1899'd;
 75         put date= yymmddd10.;
 76         run;
 
 date=2017-12-03
&lt;/PRE&gt;
&lt;P&gt;Why do we use 30dec1899? SAS uses 1960-01-01 as day &lt;STRONG&gt;zero&lt;/STRONG&gt;, while Excel uses 1900-01-01 as day &lt;STRONG&gt;1&lt;/STRONG&gt;. But Excel has a bug insofar as it considers 1900 a leap year (a bug taken over from Lotus 1-2-3 and never corrected). Therefore we need to use 1899-12-31 as day 1, and 1899-12-30 as day zero.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 13:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dates-from-excel-to-SAS-environment/m-p/665004#M198759</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-25T13:23:49Z</dc:date>
    </item>
  </channel>
</rss>

