<?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: SAS changed datetime column of my xlsx data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921460#M83358</link>
    <description>&lt;P&gt;In Excel, there is no difference between dates and times on a technical level. Dates are stored as integers, while times are always stored as&amp;nbsp;&lt;EM&gt;fraction of a day&lt;/EM&gt;, so a date can always be considered a datetime with a time part of 00:00:00.&lt;/P&gt;
&lt;P&gt;If PROC IMPORT finds only integers (and a&amp;nbsp;&lt;EM&gt;date-only format&lt;/EM&gt; like you show), it will assume this to be a pure date column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make these datetime in SAS, do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start = dhms(start,0,0,0);
end = dhms(end,0,0,0);
format start end e8601dt19.; /* or any other format you like */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, multiply the values by 86400 (number of seconds in a day). This would also keep "hidden" time parts.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2024 08:43:52 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-03-22T08:43:52Z</dc:date>
    <item>
      <title>SAS changed datetime column of my xlsx data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921456#M83357</link>
      <description>&lt;P&gt;Hi, so I was importing XLSX file with script below:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc import out=test&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;datafile="&amp;amp;paath.\Module.xlsx"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dbms=&lt;SPAN&gt;xlsx&lt;/SPAN&gt; replace;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;the import is successful but when I check the SAS file test, my datetime data converted into a date only. below is the xlsx file:&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="febyinkasid_0-1711095377566.png" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94865iFF611CF7537D0893/image-dimensions/274x174?v=v2" width="274" height="174" role="button" title="febyinkasid_0-1711095377566.png" alt="febyinkasid_0-1711095377566.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Converted into date only in SAS with yymmdd format:&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="febyinkasid_1-1711095512444.png" style="width: 273px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94866iA8D917CF3C08250E/image-dimensions/273x113?v=v2" width="273" height="113" role="button" title="febyinkasid_1-1711095512444.png" alt="febyinkasid_1-1711095512444.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="febyinkasid_2-1711095536361.png" style="width: 250px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94867i572F9D79BFC7C039/image-dimensions/250x113?v=v2" width="250" height="113" role="button" title="febyinkasid_2-1711095536361.png" alt="febyinkasid_2-1711095536361.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone has solution on how to get the field into datetime original?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Mar 2024 08:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921456#M83357</guid>
      <dc:creator>febyinkasid</dc:creator>
      <dc:date>2024-03-22T08:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS changed datetime column of my xlsx data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921460#M83358</link>
      <description>&lt;P&gt;In Excel, there is no difference between dates and times on a technical level. Dates are stored as integers, while times are always stored as&amp;nbsp;&lt;EM&gt;fraction of a day&lt;/EM&gt;, so a date can always be considered a datetime with a time part of 00:00:00.&lt;/P&gt;
&lt;P&gt;If PROC IMPORT finds only integers (and a&amp;nbsp;&lt;EM&gt;date-only format&lt;/EM&gt; like you show), it will assume this to be a pure date column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make these datetime in SAS, do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start = dhms(start,0,0,0);
end = dhms(end,0,0,0);
format start end e8601dt19.; /* or any other format you like */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, multiply the values by 86400 (number of seconds in a day). This would also keep "hidden" time parts.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 08:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921460#M83358</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-22T08:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS changed datetime column of my xlsx data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921466#M83359</link>
      <description>Thank You so much!</description>
      <pubDate>Fri, 22 Mar 2024 09:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921466#M83359</guid>
      <dc:creator>febyinkasid</dc:creator>
      <dc:date>2024-03-22T09:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS changed datetime column of my xlsx data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921507#M83360</link>
      <description>&lt;P&gt;&lt;EM&gt;The DHMS() function will also keep the fractions from the DATE value passed to it.&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;6    data test;
7      date=datetime()/'24:00't;
8      dt=dhms(date,0,0,0);
9      put date=comma20.2 date=date9. dt=datetime19.;
10   run;

date=23,457.40 date=22MAR2024 dt=22MAR2024:09:33:13
NOTE: The data set WORK.TEST has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 13:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-changed-datetime-column-of-my-xlsx-data/m-p/921507#M83360</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-22T13:34:15Z</dc:date>
    </item>
  </channel>
</rss>

