<?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: DATETIME_FORMAT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458098#M284498</link>
    <description>&lt;P&gt;Just an example, like the one below.&amp;nbsp; The n8601 informat creates a character, so the numeric datepart() function doesn't work, sorry, not used that informat before.&amp;nbsp; This does work:&lt;/P&gt;
&lt;PRE&gt;data want;
  input a $n8601e.;
  b=mdy(input(substr(a,5,1),best.),input(substr(a,6,2),best.),input(substr(a,1,4),best.));
  format b date9.;
datalines;
2018-04-06T15:45:00.377379752Z
;
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 Apr 2018 12:07:29 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-27T12:07:29Z</dc:date>
    <item>
      <title>DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458060#M284492</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to ask a question regarding input&amp;nbsp;DATETIME to SAS. I am using data from Thomson Reuters Tick History (TRTH). In Version1 of TRTH, data had two separate columns for Date and Time. However, in the second version, TRTH changes that structure and now&amp;nbsp;they provide&amp;nbsp;DATETIME column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to input csv data to SAS by using codes (not manual (File-Import Data)). When I use data from version 1, I employed the format (and informat) Date11. for Date and time18.3 for time. For example, I&amp;nbsp;run the following codes and it works very well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;infile _____________&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;" delimiter = _______________;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; informat Date_G_ DATE11. ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; informat Time_G_ time18.3 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; format Date_G_ DATE11. ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; format Time_G_ time18.3 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; input&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Date_G_&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Time_G_; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, now, I need to use format and informat for&amp;nbsp;DATETIME column. In csv format, it looks like that :&amp;nbsp;&lt;/P&gt;&lt;P&gt;2018-04-06T15:45:00.377379752Z&lt;/P&gt;&lt;P&gt;I did some search, however cannot get result. I would appreciate it if you could help me regarding that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 09:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458060#M284492</guid>
      <dc:creator>Khaladdin</dc:creator>
      <dc:date>2018-04-27T09:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458068#M284493</link>
      <description>&lt;P&gt;Looks like an ISO date with timezone offset.&amp;nbsp; You can find all the informats here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0verk17pchh4vn1akrrv0b5w3r0.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0verk17pchh4vn1akrrv0b5w3r0.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe n8601 or anydtdtm will work.&amp;nbsp; Just need to try them out and see if it matches what you expect.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 09:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458068#M284493</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-27T09:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458071#M284494</link>
      <description>$N8601Ew.d works well. Many thanks for that.</description>
      <pubDate>Fri, 27 Apr 2018 10:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458071#M284494</guid>
      <dc:creator>Khaladdin</dc:creator>
      <dc:date>2018-04-27T10:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458080#M284495</link>
      <description>&lt;P&gt;One more question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to apply datepart function to n8601 format?&lt;/P&gt;&lt;P&gt;datepart() gives '.' value.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 10:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458080#M284495</guid>
      <dc:creator>Khaladdin</dc:creator>
      <dc:date>2018-04-27T10:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458081#M284496</link>
      <description>&lt;P&gt;Should work fine, can you give a simple example in the form of a datastep?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 11:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458081#M284496</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-27T11:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458088#M284497</link>
      <description>&lt;P&gt;Did you mean the whole code?&lt;/P&gt;&lt;P&gt;I run the following codes:&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;Date=datepart(date_time);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 11:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458088#M284497</guid>
      <dc:creator>Khaladdin</dc:creator>
      <dc:date>2018-04-27T11:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458098#M284498</link>
      <description>&lt;P&gt;Just an example, like the one below.&amp;nbsp; The n8601 informat creates a character, so the numeric datepart() function doesn't work, sorry, not used that informat before.&amp;nbsp; This does work:&lt;/P&gt;
&lt;PRE&gt;data want;
  input a $n8601e.;
  b=mdy(input(substr(a,5,1),best.),input(substr(a,6,2),best.),input(substr(a,1,4),best.));
  format b date9.;
datalines;
2018-04-06T15:45:00.377379752Z
;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 12:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458098#M284498</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-27T12:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: DATETIME_FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458120#M284499</link>
      <description>Great, thanks</description>
      <pubDate>Fri, 27 Apr 2018 13:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATETIME-FORMAT/m-p/458120#M284499</guid>
      <dc:creator>Khaladdin</dc:creator>
      <dc:date>2018-04-27T13:24:56Z</dc:date>
    </item>
  </channel>
</rss>

