<?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 convert 28-APR-20 02.56.42.897749 PM   ( length is 28  char ) to DATETIME in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652767#M196022</link>
    <description>&lt;P&gt;Hi all , How to convert&amp;nbsp;28-APR-20 02.56.42.897749 PM&amp;nbsp; &amp;nbsp;( length is 28 char) to DATETIME ?&lt;/P&gt;
&lt;P&gt;Please can you help.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 06:51:30 GMT</pubDate>
    <dc:creator>dennis_oz</dc:creator>
    <dc:date>2020-06-03T06:51:30Z</dc:date>
    <item>
      <title>convert 28-APR-20 02.56.42.897749 PM   ( length is 28  char ) to DATETIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652767#M196022</link>
      <description>&lt;P&gt;Hi all , How to convert&amp;nbsp;28-APR-20 02.56.42.897749 PM&amp;nbsp; &amp;nbsp;( length is 28 char) to DATETIME ?&lt;/P&gt;
&lt;P&gt;Please can you help.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 06:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652767#M196022</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-06-03T06:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: convert 28-APR-20 02.56.42.897749 PM   ( length is 28  char ) to DATETIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652768#M196023</link>
      <description>&lt;P&gt;See&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
string = "28-APR-20 02.56.42.897749 PM";
date = input(scan(string,1," "),date9.);
time = input(substr(string,11),time20.);
datetime = dhms(date,0,0,time);
format
  date yymmddd10.
  time time15.6
  datetime e8601dt26.6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2020 07:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652768#M196023</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-03T07:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: convert 28-APR-20 02.56.42.897749 PM   ( length is 28  char ) to DATETIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652774#M196028</link>
      <description>&lt;P&gt;You can also wrap up the solution by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;in a macro function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro dt_AMPM(str);
  %local time date;
  %let date=input(&amp;amp;str,date9.);
  %let time=input(substr(&amp;amp;str,11,time20.);
dhms(&amp;amp;date,0,0,&amp;amp;time)
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This function can then be used in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  datetime=%dt_AMPM(date_str);
  format datetime datetime25.6;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which may be a nice solution if you have more than one datetime string in this format.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 07:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652774#M196028</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-06-03T07:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: convert 28-APR-20 02.56.42.897749 PM   ( length is 28  char ) to DATETIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652776#M196029</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19264"&gt;@dennis_oz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try informat datetime30.6 to keep the highest precision:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	string = "28-APR-20 02.56.42.897749 PM";
	string_n = input(string, DATETIME30.6);
	format string_n e8601dt26.6;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 07:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-28-APR-20-02-56-42-897749-PM-length-is-28-char-to/m-p/652776#M196029</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-03T07:49:11Z</dc:date>
    </item>
  </channel>
</rss>

