<?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: How to convert from datetime16. to character mm/dd/yyyy with slashes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288422#M59482</link>
    <description>Thanks so much!&lt;BR /&gt;</description>
    <pubDate>Sun, 31 Jul 2016 22:23:30 GMT</pubDate>
    <dc:creator>gblock</dc:creator>
    <dc:date>2016-07-31T22:23:30Z</dc:date>
    <item>
      <title>How to convert from datetime16. to character mm/dd/yyyy with slashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288403#M59477</link>
      <description>&lt;P&gt;I have a date (has month day year time) which Proc Contents says is datetime16. I want to convert it to a character string of format mm/dd/yyyy, with slashes and no time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using SAS 9.4, 64bit, on a Mac through Parallels.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jul 2016 17:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288403#M59477</guid>
      <dc:creator>gblock</dc:creator>
      <dc:date>2016-07-31T17:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert from datetime16. to character mm/dd/yyyy with slashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288407#M59478</link>
      <description>&lt;P&gt;Create a new 10-byte char variable, and PUT the date part of the value using the MMDDYY10. format. &amp;nbsp;The DATEPART function will create the date value that you can format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
&amp;nbsp; set have; /* data with a datetime var, let's call it dt */
&amp;nbsp; length chardate $ 10;
&amp;nbsp; chardate = put(datepart(dt), mmddyy10.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But... why? &amp;nbsp;Perhaps just to export to something else for a text-based report? &amp;nbsp;While the value is in SAS, &lt;A href="http://blogs.sas.com/content/sasdummy/2011/11/15/do-you-mind-if-we-dance-with-your-dates/" target="_self"&gt;you can format and report/analyze without having to create a new variable&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jul 2016 18:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288407#M59478</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-07-31T18:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert from datetime16. to character mm/dd/yyyy with slashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288422#M59482</link>
      <description>Thanks so much!&lt;BR /&gt;</description>
      <pubDate>Sun, 31 Jul 2016 22:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288422#M59482</guid>
      <dc:creator>gblock</dc:creator>
      <dc:date>2016-07-31T22:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert from datetime16. to character mm/dd/yyyy with slashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288710#M59561</link>
      <description>&lt;P&gt;If you are ever likely to want to sort on the data, or possibly group by month and year, or year and quarter or similar you might consider adding another date variable with the appropriate default format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dateonly = datepart(datetimevariable);&lt;/P&gt;
&lt;P&gt;format dateonly mmddyy10. ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the dateonly variable for the x-axis of a graph will have values sort in chronologically. If you use a character then you get a sort order like: 01/01/2015, 01/01/2016, 01/02/2015, 01/02/2016 which is not often the desired appearance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 19:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-from-datetime16-to-character-mm-dd-yyyy-with/m-p/288710#M59561</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-01T19:53:36Z</dc:date>
    </item>
  </channel>
</rss>

