<?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 conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580643#M164957</link>
    <description>&lt;P&gt;You could keep the values as DATETIME and make user defined picture format to display it the way you want.&lt;/P&gt;
&lt;P&gt;Or you could create a character variable that displays the value the way you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length char_var $16;
char_var=catx(' ',put(datepart(datetime_var),mmddyyd10.),put(timepart(datetime_var),tod5.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you probably do NOT want to use MM-DD-YYYY (or DD-MM-YYY either) to display your datetime values. Which ever one you pick will confuse half of the people reading the reports. Plus the character string version will not sort in chronological order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use YYYY-MM-DD instead.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Aug 2019 19:47:04 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-08-12T19:47:04Z</dc:date>
    <item>
      <title>Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580601#M164942</link>
      <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I have suggestions on how to format a SAS date to this&amp;nbsp; 12&lt;FONT size="4"&gt;&lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/FONT&gt;05&lt;FONT size="4"&gt;&lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/FONT&gt;2018 15:56.&amp;nbsp; I need dashes &lt;STRONG&gt;not&lt;/STRONG&gt; slashes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; THANKS!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 16:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580601#M164942</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2019-08-12T16:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580603#M164943</link>
      <description>&lt;P&gt;To make a DATE look xx-xx-xxxx use either MMDDYYD or DDMMYYD format, depending on whether your example was supposed to represent the Dec 5th or 12th of May.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why does you example include a time part?&amp;nbsp; Do you want to make a DATETIME value instead of DATE value?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 16:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580603#M164943</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-12T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580627#M164950</link>
      <description>I don't believe there's a default format that does this. But if you check the posts from the last month that revolve around date or datetime I'm about 99% certain this exact question was asked and answered about 3 times in the past few weeks.</description>
      <pubDate>Mon, 12 Aug 2019 18:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580627#M164950</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-12T18:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580634#M164954</link>
      <description>correct. It needs to be a datetime.&lt;BR /&gt;thanks!&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Aug 2019 19:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580634#M164954</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2019-08-12T19:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580636#M164955</link>
      <description>Yes, that's the issue: I can not find a default datetime format to accomplish this. I did look in recent posts but I can not find another similar, however, I will search again. Do you happen to remember the tittle of the post as I have seen several date/time issues discussed&amp;nbsp; but none that specifically address formatting with slashes (and include time).&lt;BR /&gt;I do have&amp;nbsp; solution in mind but curious to see if there was some other creative ideas!&amp;nbsp;thanks, take care!&amp;nbsp;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Aug 2019 19:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580636#M164955</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2019-08-12T19:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580637#M164956</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/FileName-with-Date-and-Time/m-p/578096/highlight/true#M13296" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/FileName-with-Date-and-Time/m-p/578096/highlight/true#M13296&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format; 
  picture  datetimeStamp
          low-high='%Y-%0m-%0d %0H:%0M' (datatype=datetime);
run;

%put %sysfunc(datetime(), datetimeStamp.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;documentation reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0n990vq8gxca6n1vnsracr6jp2c.htm&amp;amp;docsetVersion=3.1&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0n990vq8gxca6n1vnsracr6jp2c.htm&amp;amp;docsetVersion=3.1&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 19:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580637#M164956</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-12T19:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580643#M164957</link>
      <description>&lt;P&gt;You could keep the values as DATETIME and make user defined picture format to display it the way you want.&lt;/P&gt;
&lt;P&gt;Or you could create a character variable that displays the value the way you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length char_var $16;
char_var=catx(' ',put(datepart(datetime_var),mmddyyd10.),put(timepart(datetime_var),tod5.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you probably do NOT want to use MM-DD-YYYY (or DD-MM-YYY either) to display your datetime values. Which ever one you pick will confuse half of the people reading the reports. Plus the character string version will not sort in chronological order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use YYYY-MM-DD instead.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 19:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580643#M164957</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-12T19:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580677#M164971</link>
      <description>super cool! thanks!&amp;nbsp;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Aug 2019 22:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-conversion/m-p/580677#M164971</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2019-08-12T22:56:43Z</dc:date>
    </item>
  </channel>
</rss>

