<?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 Date Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902445#M356641</link>
    <description>&lt;P&gt;Yes , it did not work. Indeed , I have two column&amp;nbsp; DateChar and DateNum . For DateNum everything Ok , I have only issue in DateChar and I have to keep this column .&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2023 08:08:44 GMT</pubDate>
    <dc:creator>ndamo</dc:creator>
    <dc:date>2023-11-10T08:08:44Z</dc:date>
    <item>
      <title>How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902373#M356612</link>
      <description>&lt;P&gt;Dear Communities ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am challenged with the Date format .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what should I do to get the same format as Date 1 and Date 2 for Date 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="346px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date name&amp;nbsp;&lt;/TD&gt;
&lt;TD width="141.828px"&gt;DateChar&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 1&lt;/TD&gt;
&lt;TD width="141.828px"&gt;22AUG2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 2&lt;/TD&gt;
&lt;TD width="141.828px"&gt;06SEP2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 3&lt;/TD&gt;
&lt;TD width="141.828px"&gt;29/SEP/2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my program :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DateChar=INPUT(DateChar,DATE9.) ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FORMAT DateChar DATE9. ;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advanced&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 17:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902373#M356612</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2023-11-09T17:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902375#M356613</link>
      <description>&lt;P&gt;DATE9. won't work because the third date has more than 9 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried DATE11.&amp;nbsp; ??&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 18:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902375#M356613</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-09T18:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902384#M356619</link>
      <description>&lt;P&gt;You cannot store a NUMBER into a character variable.&lt;/P&gt;
&lt;P&gt;You need to use a large enough WIDTH on the INFORMAT to read ALL of the relevant characters from the source string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To leave the variable has character use the PUT() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DateChar=put(input(DateChar,date11.),date9.) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To store the value as an actual DATE you will need to make a NEW variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DateNum=input(DateChar,date11.);
format DateNum date9.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2023 18:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902384#M356619</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-09T18:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902445#M356641</link>
      <description>&lt;P&gt;Yes , it did not work. Indeed , I have two column&amp;nbsp; DateChar and DateNum . For DateNum everything Ok , I have only issue in DateChar and I have to keep this column .&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 08:08:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902445#M356641</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2023-11-10T08:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902460#M356651</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225295"&gt;@ndamo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes , it did not work. Indeed , I have two column&amp;nbsp; DateChar and DateNum . For DateNum everything Ok , I have only issue in DateChar and I have to keep this column .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please from now on never say "it did not work" and then you don't show us your code. We can't help you if you don't show us your code, as without your code no one can understand this message.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 10:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902460#M356651</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-10T10:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902477#M356662</link>
      <description>&lt;P&gt;As I mentioned in begining, in my inital raw data , I have and the length of Date is $20. :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="346px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date name&amp;nbsp;&lt;/TD&gt;
&lt;TD width="141.828px"&gt;Date&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 1&lt;/TD&gt;
&lt;TD width="141.828px"&gt;22AUG2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 2&lt;/TD&gt;
&lt;TD width="141.828px"&gt;06SEP2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="203.172px"&gt;Date 3&lt;/TD&gt;
&lt;TD width="141.828px"&gt;29/SEP/2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in my program :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DateChar=INPUT(DateChar,DATE9.) ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FORMAT DateChar DATE9. ;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After runing this&amp;nbsp; pgm, two columns created :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="1106"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date Name&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;DateChar&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;DateNum&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 1&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;22AUG2023&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;22AUG2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 2&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;06SEP2023&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;06SEP2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 3&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;29/SEP/2023&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;29SEP2020&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 4&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In DateNum everything Ok however in DateChar , something wrong . It concerns only Date 3&amp;nbsp; or Date 4 .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 12:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902477#M356662</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2023-11-10T12:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902478#M356663</link>
      <description>&lt;P&gt;You need to try the informat DATE11.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;datenum=input(datechar,date11.);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Additional comment: from now on, when we ask to see your code, show us the ENTIRE data step, not just one or two lines.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 12:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902478#M356663</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-10T12:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902492#M356671</link>
      <description>&lt;P&gt;Thank you , for DateNum is Ok . and How should I do to remove the slash in DateChar?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to perform something like&amp;nbsp; :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF &lt;SPAN&gt;Date Name = Date 3 , DateChar=DDMMMYYYY.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;My expected result is =&amp;gt; :&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="1106"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date Name&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;DateChar&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;DateNum&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 1&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;22AUG2023&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;22AUG2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 2&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;06SEP2023&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;06SEP2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="560px" height="30px"&gt;Date 3&lt;/TD&gt;
&lt;TD width="279.5px" height="30px"&gt;&lt;FONT color="#993300"&gt;29SEP2023&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="265.5px" height="30px"&gt;29SEP2020&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 10 Nov 2023 13:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902492#M356671</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2023-11-10T13:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902494#M356672</link>
      <description>&lt;P&gt;Thank&amp;nbsp; you .&amp;nbsp; The issue is resolved with the PUT fonction .&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 13:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-Date-Format/m-p/902494#M356672</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2023-11-10T13:43:29Z</dc:date>
    </item>
  </channel>
</rss>

