<?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: Unable to Read Dates having Custom format(dd/mm/yyyy) from xlsx file using PROC Import in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531592#M5916</link>
    <description>&lt;P&gt;Thankyou for the solution. The logic worked here.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 09:47:15 GMT</pubDate>
    <dc:creator>snigdhaguha01</dc:creator>
    <dc:date>2019-01-31T09:47:15Z</dc:date>
    <item>
      <title>Unable to Read Dates having Custom format(dd/mm/yyyy) from xlsx file using PROC Import</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531378#M5892</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying read an external .xlsx file using PROC IMPORT.&lt;/P&gt;&lt;P&gt;But the dates stored in the .xlsx file&amp;nbsp;as CUSTOM in dd/mm/yyyy format are not read correctly. only the character variables are read fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For e.g. In .xlsx file we have&amp;nbsp;DATE= 01/21/2019 , but after importing the&amp;nbsp;file, the&amp;nbsp;value changes&amp;nbsp;as DATE=43486.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On checking the PROC CONTENTS&amp;nbsp; for the same variable, DATE, it&amp;nbsp;has TYPE= NUM,LEN=8, FORMAT = BEST.&lt;/P&gt;&lt;P&gt;The DATE is needed in the format of YYYYMMDD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest some way out to fix the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 14:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531378#M5892</guid>
      <dc:creator>snigdhaguha01</dc:creator>
      <dc:date>2019-01-30T14:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Read Dates having Custom format(dd/mm/yyyy) from xlsx file using PROC Import</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531382#M5893</link>
      <description>&lt;P&gt;First of all, the usual message:&lt;/P&gt;
&lt;P&gt;Excel files are utter CRAP for any kind of data transfer. The only method worse would be clay tablets with data carved in with hammer &amp;amp; chisel.&lt;/P&gt;
&lt;P&gt;So you should save your data to a csv file and read that with a data step if you want to have correct and consistent results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having said that, it looks like you're getting the raw date values from Excel. Since Excel counts from 30dec1899 (Excel has a well known bug, so it's not 31dec), you need to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
x1 = 43486;
x1 = x1 + '30dec1899'd;
format x1 yymmddd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(line 3 is the important one)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 14:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531382#M5893</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-30T14:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Read Dates having Custom format(dd/mm/yyyy) from xlsx file using PROC Import</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531592#M5916</link>
      <description>&lt;P&gt;Thankyou for the solution. The logic worked here.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 09:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-Read-Dates-having-Custom-format-dd-mm-yyyy-from-xlsx/m-p/531592#M5916</guid>
      <dc:creator>snigdhaguha01</dc:creator>
      <dc:date>2019-01-31T09:47:15Z</dc:date>
    </item>
  </channel>
</rss>

