<?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 Date time informat that works when the date time lengths are  different in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-time-informat-that-works-when-the-date-time-lengths-are/m-p/456514#M115639</link>
    <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the following variable 'a', I need to use two informats to get the output I need. Is there any other format that can both OBS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output needed;&lt;/P&gt;
&lt;P&gt;b&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01SEP17:15:10:00&lt;/P&gt;
&lt;P&gt;04SEP17:00:00:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input a $16.;
datalines;
2017-09-01T15:10
2017-09-04
;
data two;
set one;
b=input(a, anydtdtm.);
c=input(a,?? is8601dt.);
format b c datetime16.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 23 Apr 2018 13:30:12 GMT</pubDate>
    <dc:creator>knveraraju91</dc:creator>
    <dc:date>2018-04-23T13:30:12Z</dc:date>
    <item>
      <title>Date time informat that works when the date time lengths are  different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-informat-that-works-when-the-date-time-lengths-are/m-p/456514#M115639</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the following variable 'a', I need to use two informats to get the output I need. Is there any other format that can both OBS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output needed;&lt;/P&gt;
&lt;P&gt;b&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01SEP17:15:10:00&lt;/P&gt;
&lt;P&gt;04SEP17:00:00:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input a $16.;
datalines;
2017-09-01T15:10
2017-09-04
;
data two;
set one;
b=input(a, anydtdtm.);
c=input(a,?? is8601dt.);
format b c datetime16.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Apr 2018 13:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-informat-that-works-when-the-date-time-lengths-are/m-p/456514#M115639</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2018-04-23T13:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Date time informat that works when the date time lengths are  different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-time-informat-that-works-when-the-date-time-lengths-are/m-p/456523#M115643</link>
      <description>&lt;P&gt;Well, a simple conditional:&lt;/P&gt;
&lt;PRE&gt;data one;
  input a $16.;
datalines;
2017-09-01T15:10
2017-09-04
;
run;

data two;
  set one;
  b=ifn(lengthn(a)=10,input(catx('T',a,"00:00"),e8601dt.),input(a,e8601dt.));
  format b datetime.;
run;&lt;/PRE&gt;
&lt;P&gt;Its more or less the same thing however.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 13:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-time-informat-that-works-when-the-date-time-lengths-are/m-p/456523#M115643</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-23T13:38:54Z</dc:date>
    </item>
  </channel>
</rss>

