<?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: Convert datetime16 format to a  character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498613#M132552</link>
    <description>I would recommend it you are converting a SAS date-time to character to use a format that will sort like one of the ISO8601 formats.</description>
    <pubDate>Mon, 24 Sep 2018 23:31:04 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2018-09-24T23:31:04Z</dc:date>
    <item>
      <title>Convert datetime16 format to a  character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498579#M132529</link>
      <description>I have a table where the datetime firld is formats&lt;BR /&gt;&lt;BR /&gt;23Sep18:11:32:00. Which is datetime 16&lt;BR /&gt;&lt;BR /&gt;I need that field to be formatted as a character.&lt;BR /&gt;&lt;BR /&gt;Like this&lt;BR /&gt;23Sep18:11:32:00</description>
      <pubDate>Mon, 24 Sep 2018 20:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498579#M132529</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2018-09-24T20:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert datetime16 format to a  character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498582#M132531</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
informat dt datetime16.;
format dt datetime16.;
dt="23Sep18:11:32:00"dt;
dtChar=put(dt, datetime16.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Sep 2018 20:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498582#M132531</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-24T20:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert datetime16 format to a  character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498584#M132533</link>
      <description>&lt;P&gt;Note that formats are instructions for how to convert values into character strings for display purposes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like you want to create a new VARIABLE that is character instead of numeric.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  length char_date $16 ;
  char_date = put(real_date,datetime16.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would highly recommend not using a format that does not display the century for dates.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that there is bug (feature?) of the DATETIME format that makes it not use 4 digit years when use a width of 18. So use a width of 19 instead and add the -L format option or LEFT() function call to remove the leading space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  length char_date $18;
  char_date = put(real_date,datetime19.-L);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 20:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498584#M132533</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-24T20:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert datetime16 format to a  character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498613#M132552</link>
      <description>I would recommend it you are converting a SAS date-time to character to use a format that will sort like one of the ISO8601 formats.</description>
      <pubDate>Mon, 24 Sep 2018 23:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-datetime16-format-to-a-character/m-p/498613#M132552</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-09-24T23:31:04Z</dc:date>
    </item>
  </channel>
</rss>

