<?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 Date conversion when importing a file in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610452#M18530</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import data with columns "shop", "id", "2019-01-01", "2019-02-01", "2019-03-01", "2019-04-01". I have problem with date because SAS read it as "42455" etc. How can I fix it?&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2019 13:15:39 GMT</pubDate>
    <dc:creator>ab97_cd</dc:creator>
    <dc:date>2019-12-09T13:15:39Z</dc:date>
    <item>
      <title>Date conversion when importing a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610452#M18530</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import data with columns "shop", "id", "2019-01-01", "2019-02-01", "2019-03-01", "2019-04-01". I have problem with date because SAS read it as "42455" etc. How can I fix it?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 13:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610452#M18530</guid>
      <dc:creator>ab97_cd</dc:creator>
      <dc:date>2019-12-09T13:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion when importing a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610455#M18531</link>
      <description>&lt;P&gt;Save from Excel as csv, read with a data step where you use proper column names, then immediately transpose to a long format. After the transposition, convert the _name_ column to a SAS date column.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 13:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610455#M18531</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-09T13:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion when importing a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610493#M18534</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/297212"&gt;@ab97_cd&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to import data with columns "shop", "id", "2019-01-01", "2019-02-01", "2019-03-01", "2019-04-01". I have problem with date because SAS read it as "42455" etc. How can I fix it?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Variable names are character strings, not dates or numbers.&amp;nbsp; So if you tried to read an Excel file where the variable names were entered into the cells as dates instead of as strings then SAS will convert them into strings.&lt;/P&gt;
&lt;P&gt;When SAS reads a date value from Excel as a string it gets the underlying number that Excel uses for that date converted into a character string.&amp;nbsp; To convert back to a date first convert them to a number and then add the negative value that SAS uses for the base date that Excel uses for dates.&amp;nbsp; Excel numbers from 1900 and SAS from 1960 but there is an additional 2 day difference because of difference in whether to count from zero or one and because Excel mistakenly treats 1900 as a leap year.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = input(date_string,32.)+'30DEC1899'd ;
format date yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Date-conversion-when-importing-a-file/m-p/610493#M18534</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-09T15:20:56Z</dc:date>
    </item>
  </channel>
</rss>

