<?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: String 26 to DATE - TIME in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291892#M19919</link>
    <description>&lt;P&gt;The simplest option is to replace the dash after the date with a 'T' or a blank ('T' is better, as it conforms to the ISO standard) and use the e8601dt informat for conversion.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format outvar datetime25.6;
substr(invar,11,1) = 'T';
outvar = input(invar,e8601dt26.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 16 Aug 2016 13:32:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-08-16T13:32:27Z</dc:date>
    <item>
      <title>String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291879#M19917</link>
      <description>&lt;P&gt;Hi guys&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How can I convert this 26 lenght string "2016-08-11-15.48.53.216961" to&amp;nbsp;date time format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards from Brazil&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291879#M19917</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-08-16T13:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291885#M19918</link>
      <description>&lt;P&gt;I'm not sure that's a standard datetime format. &amp;nbsp;The closest match I see is &lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n1vfxvbhrvzahjn1iciq1vruyc9d.htm" target="_self"&gt;the E8601DTw.d&amp;nbsp;informat&lt;/A&gt;. &amp;nbsp;Find the &lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#p1a0qt18rxydrkn1b0rtdfh2t8zs.htm" target="_self"&gt;list of ISO date/time formats and informats here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length dt 8;
  format dt datetime20.;
  /* different than 2016-08-11-15.48.53.216961 */
  dt = input("2016-08-11T15:48:53.216961", E8601DT26.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work, you might need to parse out the pieces and build your own datetime value in piecemeal.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291885#M19918</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-08-16T13:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291892#M19919</link>
      <description>&lt;P&gt;The simplest option is to replace the dash after the date with a 'T' or a blank ('T' is better, as it conforms to the ISO standard) and use the e8601dt informat for conversion.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format outvar datetime25.6;
substr(invar,11,1) = 'T';
outvar = input(invar,e8601dt26.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291892#M19919</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-16T13:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291899#M19920</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;'s approach is&amp;nbsp;&lt;STRONG&gt;so&amp;nbsp;&lt;/STRONG&gt;much simpler than parsing out the pieces! I had been working on an alternative that coerced the value by replacing the '-' with the 'T' and various '.' with ':' -- but Kurt's is much more elegant so I won't bother to share &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291899#M19920</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-08-16T13:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291904#M19922</link>
      <description>&lt;P&gt;Am I doing something wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
set A;
/*DATA_HORA_INCLUSAO_TEMP*/
format outvar datetime25.6;
substr(DATA_HORA_INCLUSAO_TEMP,11,1) = 'T';
outvar = input(DATA_HORA_INCLUSAO_TEMP,e8601dt26.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="4" color="#339966"&gt;&lt;STRONG&gt;NOTE: Invalid argument to function INPUT at line 20 column 10.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4" color="#339966"&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4611iFFE348C03AF4E518/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="untitled.JPG" title="untitled.JPG" /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291904#M19922</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-08-16T13:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291908#M19923</link>
      <description>&lt;P&gt;Ah, I overlooked that one. The dots in the time need to be replaced with colons:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
invar = '2016-08-11T15.48.53.216961';
format outvar datetime25.6;
substr(invar,14,1) = ':';
substr(invar,17,1) = ':';
outvar = input(invar,e8601dt26.6);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291908#M19923</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-16T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291910#M19924</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Thank you very much guys.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4612iDCC53DB4F77D9FF0/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="untitled1.JPG" title="untitled1.JPG" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291910#M19924</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-08-16T14:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291912#M19925</link>
      <description>&lt;P&gt;Ha! I should have kept going and posted my approach!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length dt 8 dt2 8 fixdate $ 26 origdate $ 26;
  format dt datetime26.6 dt2 datetime26.6;

  /* using properly formatted input */
  dt = input("2016-08-11T15:48:53.216961", E8601DT26.);
 
  /* supplied input */
  origdate = "2016-08-11-15.48.53.216961";

  /* coerce the incoming date to a proper format */
  fixdate = substr(origdate,1,10) || 'T' 
      || translate(substr(origdate,12,8),':','.') || '.'
      || substr(origdate,21,6); 

  dt2 = input(fixdate, E8601DT26.);
 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291912#M19925</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-08-16T14:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: String 26 to DATE - TIME</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291922#M19927</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Got it Chris!! Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/String-26-to-DATE-TIME/m-p/291922#M19927</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-08-16T14:54:00Z</dc:date>
    </item>
  </channel>
</rss>

