<?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: Extract date part from timestamp string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898050#M354949</link>
    <description>It worked perfectly. That addition part is the key I was not considering.&lt;BR /&gt;Thank you.</description>
    <pubDate>Wed, 11 Oct 2023 02:55:14 GMT</pubDate>
    <dc:creator>sascode</dc:creator>
    <dc:date>2023-10-11T02:55:14Z</dc:date>
    <item>
      <title>Extract date part from timestamp string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898048#M354947</link>
      <description>&lt;P&gt;Hello, i have a dataset as follows:&lt;BR /&gt;data have;&lt;BR /&gt;length number $ 54;&lt;BR /&gt;input number $;&lt;BR /&gt;datalines;&lt;BR /&gt;44991.65 &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;This number which is coming as character in SAS, represents in excel&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="215px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="215px"&gt;3/6/23 3:29 PM&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;So the question is, how to extract only the date part from this number?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 02:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898048#M354947</guid>
      <dc:creator>sascode</dc:creator>
      <dc:date>2023-10-11T02:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract date part from timestamp string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898049#M354948</link>
      <description>&lt;P&gt;Fix your Excel file so that the column with the DATETIME values does not have any cells with character strings.&amp;nbsp; Then the value will come as a numeric DATETIME value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't fix it then you will have to convert it to a number and add the negative number that represents 30DEC1899 to adjust for the difference in how SAS and Excel number days.&lt;/P&gt;
&lt;P&gt;The fraction of a day is ignored by the DATE format, but to remove it you can use the INT() function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = int(input(number,32.)) + '30DEC1899'd ;
format date date9.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the longest string that the normal numeric informat can read is 32 characters, which should be longer than any string you get from Excel that represents an actual datetime value.&amp;nbsp; If you really have some other string that is 54 characters long then that is probably what is causing the actual dates to be converted to strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 02:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898049#M354948</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-10-11T02:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract date part from timestamp string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898050#M354949</link>
      <description>It worked perfectly. That addition part is the key I was not considering.&lt;BR /&gt;Thank you.</description>
      <pubDate>Wed, 11 Oct 2023 02:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-date-part-from-timestamp-string/m-p/898050#M354949</guid>
      <dc:creator>sascode</dc:creator>
      <dc:date>2023-10-11T02:55:14Z</dc:date>
    </item>
  </channel>
</rss>

