<?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 Formatting of Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatting-of-Date/m-p/121537#M259790</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello Members,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some help on formatting a sas date. I have character field E_Date_Time, where values are in the format "9/1/2011 9:25:36". Now, I need the values in date format as "09/01/2011 09:25:36". My code is not working the way I want it to work. I am trying to extract the date and time from E_Date_Time, format them separately and attach them back. The date and time can be separated by ':' or space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format E_Date mmddyy10.;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;E_Date=input(tranwrd(E_Date_Time, ' 0:00:00', ' '), mmddyy10.);&lt;/P&gt;&lt;P&gt;E_Time=scan(E_Date_Time, -1,' ');&lt;/P&gt;&lt;P&gt;E_Date_Time_New=catx(':', E_Date, E_Time);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result&amp;nbsp; of var E_Date_Time_New for the above mentioned value is:&lt;/P&gt;&lt;P&gt;18871:9:25:36&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2013 02:09:08 GMT</pubDate>
    <dc:creator>zoomzoom</dc:creator>
    <dc:date>2013-02-26T02:09:08Z</dc:date>
    <item>
      <title>Formatting of Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-of-Date/m-p/121537#M259790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello Members,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some help on formatting a sas date. I have character field E_Date_Time, where values are in the format "9/1/2011 9:25:36". Now, I need the values in date format as "09/01/2011 09:25:36". My code is not working the way I want it to work. I am trying to extract the date and time from E_Date_Time, format them separately and attach them back. The date and time can be separated by ':' or space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format E_Date mmddyy10.;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;E_Date=input(tranwrd(E_Date_Time, ' 0:00:00', ' '), mmddyy10.);&lt;/P&gt;&lt;P&gt;E_Time=scan(E_Date_Time, -1,' ');&lt;/P&gt;&lt;P&gt;E_Date_Time_New=catx(':', E_Date, E_Time);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result&amp;nbsp; of var E_Date_Time_New for the above mentioned value is:&lt;/P&gt;&lt;P&gt;18871:9:25:36&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 02:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-of-Date/m-p/121537#M259790</guid>
      <dc:creator>zoomzoom</dc:creator>
      <dc:date>2013-02-26T02:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting of Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-of-Date/m-p/121538#M259791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In SAS all the dates will be in numeric format that's the reason you are getting value as 18871 in the code above. Just try the below code you will be getting the proper date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E_Date=input(E_Date_Time, mmddyy10.);&lt;/P&gt;&lt;P&gt;E_Time=scan(E_Date_Time, -1,' ');&lt;/P&gt;&lt;P&gt;E_Date_Time_New=catx(':',put(E_Date, mmddyy10.), E_Time);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the third statement I have converted the numric date to character date again, so that you will get the required date format value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Moovendhan D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 06:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-of-Date/m-p/121538#M259791</guid>
      <dc:creator>DMoovendhan</dc:creator>
      <dc:date>2013-02-26T06:35:25Z</dc:date>
    </item>
  </channel>
</rss>

