<?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: Importing Excel TIME format changes in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51062#M5519</link>
    <description>SAS imports Excel times as date-times; I think because Excel stores it as a date-time "under the hood".  So it takes the Excel file and does the best it can.  If you had formated the Excel column as a Date-Time, it would have shown the first as 1/0/00 3:56 PM and that is what SAS is trying to convert into a **valid** datetime value in SAS.&lt;BR /&gt;
&lt;BR /&gt;
Time arithmetic still works, so OUT-IN would result in the number of seconds between the two times.  (Warning-- it can get messy when the time wraps around to the next day).&lt;BR /&gt;
&lt;BR /&gt;
You can convert the date time to a time by&lt;BR /&gt;
&lt;BR /&gt;
IN -('30Dec1988'd * (24*60*60) )&lt;BR /&gt;
&lt;BR /&gt;
and change the format.&lt;BR /&gt;
&lt;BR /&gt;
If you have a separate date field (say DateIn), you can convert the IN variable in SAS to a valid SAS datetime by&lt;BR /&gt;
&lt;BR /&gt;
IN + (DateIn -'30Dec1899'D)*(24*60*60)&lt;BR /&gt;
&lt;BR /&gt;
(read the SAS Base manual about Dates &amp;amp; Times to understand what I did.).&lt;BR /&gt;
&lt;BR /&gt;
Without exporting the Excel spreadsheet as a .csv file, I don't know how to use INFILE to get the data in.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
    <pubDate>Wed, 01 Oct 2008 21:26:02 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2008-10-01T21:26:02Z</dc:date>
    <item>
      <title>Importing Excel TIME format changes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51061#M5518</link>
      <description>Hi, I'm new to SAS EG. (no programming background). when I import this excel file into sas (File &amp;gt; Import data &amp;gt; Local Computer &amp;gt;reports.xls).&lt;BR /&gt;
it gives me this pop up&lt;BR /&gt;
Import Data with 3 options, Region to Import, Column Options &amp;amp; Results. I click RUN&lt;BR /&gt;
the reports excel file looks like this&lt;BR /&gt;
IN              OUT&lt;BR /&gt;
3:56 PM	4:56 PM&lt;BR /&gt;
6:18 PM	6:48 PM&lt;BR /&gt;
11:09 AM	11:25 AM&lt;BR /&gt;
&lt;BR /&gt;
SAS converts it into&lt;BR /&gt;
30DEC1899:03:56:00 PM	30DEC1899:04:56:00 PM&lt;BR /&gt;
30DEC1899:06:18:00 PM	30DEC1899:06:48:00 PM&lt;BR /&gt;
30DEC1899:11:09:00 AM	30DEC1899:11:25:00 AM&lt;BR /&gt;
 &lt;BR /&gt;
WHERE IS IT GETTING 30DEC1899 FROM ???&lt;BR /&gt;
Please help.&lt;BR /&gt;
Also, is there a INFILE code to import this file into SAS EG. I have this file saved on my desktop (reports.xls).&lt;BR /&gt;
Jay</description>
      <pubDate>Wed, 01 Oct 2008 20:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51061#M5518</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-01T20:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel TIME format changes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51062#M5519</link>
      <description>SAS imports Excel times as date-times; I think because Excel stores it as a date-time "under the hood".  So it takes the Excel file and does the best it can.  If you had formated the Excel column as a Date-Time, it would have shown the first as 1/0/00 3:56 PM and that is what SAS is trying to convert into a **valid** datetime value in SAS.&lt;BR /&gt;
&lt;BR /&gt;
Time arithmetic still works, so OUT-IN would result in the number of seconds between the two times.  (Warning-- it can get messy when the time wraps around to the next day).&lt;BR /&gt;
&lt;BR /&gt;
You can convert the date time to a time by&lt;BR /&gt;
&lt;BR /&gt;
IN -('30Dec1988'd * (24*60*60) )&lt;BR /&gt;
&lt;BR /&gt;
and change the format.&lt;BR /&gt;
&lt;BR /&gt;
If you have a separate date field (say DateIn), you can convert the IN variable in SAS to a valid SAS datetime by&lt;BR /&gt;
&lt;BR /&gt;
IN + (DateIn -'30Dec1899'D)*(24*60*60)&lt;BR /&gt;
&lt;BR /&gt;
(read the SAS Base manual about Dates &amp;amp; Times to understand what I did.).&lt;BR /&gt;
&lt;BR /&gt;
Without exporting the Excel spreadsheet as a .csv file, I don't know how to use INFILE to get the data in.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Wed, 01 Oct 2008 21:26:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51062#M5519</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2008-10-01T21:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel TIME format changes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51063#M5520</link>
      <description>Have you tried the SCANTIME=YES option (valid both in proc import and libname excel)? Make sure that your Excel file does not have any date or datetime values in your time columns.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Thu, 02 Oct 2008 07:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51063#M5520</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-10-02T07:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel TIME format changes</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51064#M5521</link>
      <description>When you get pop up Import Data with 3 options go to Column Options. Find trouble field. And at right you seen window, where you may find "Display format". Choose format that you nedeed, and enjoy )</description>
      <pubDate>Wed, 23 Dec 2009 10:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Importing-Excel-TIME-format-changes/m-p/51064#M5521</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-23T10:22:20Z</dc:date>
    </item>
  </channel>
</rss>

