<?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 change a date format correctly? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595306#M15774</link>
    <description>&lt;P&gt;I already tried the first solution, and it doesn't work, thus my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess the problem comes from the 0:00:00 after the date. The problem seems to convert the datetime into a date, then applying the format is easy.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 10:15:12 GMT</pubDate>
    <dc:creator>PierreYvesILY</dc:creator>
    <dc:date>2019-10-10T10:15:12Z</dc:date>
    <item>
      <title>how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595299#M15771</link>
      <description>&lt;P&gt;dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have very ofter the same problem: I need to change the format of a date for another, and it is always sourec of many dificulties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to change the following : 07MAR1996:00:00:00 (format is DATETIME20.)&lt;/P&gt;&lt;P&gt;into : 07.03.1996&amp;nbsp; (format : ddmmyyp10.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how should I proceed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance,&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 09:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595299#M15771</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2019-10-10T09:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595304#M15773</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281554"&gt;@PierreYvesILY&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do it in a data step or in a proc datasets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mytable;
	set mytable;
	format date ddmmyyp10.; /* specify the variable name and the desired format*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=work;
	modify mytable ;
	format date ddmmyyp10.; /* specify the variable name and the desired format*/
quit;&lt;/CODE&gt;&lt;/PRE&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, 10 Oct 2019 10:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595304#M15773</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-10T10:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595306#M15774</link>
      <description>&lt;P&gt;I already tried the first solution, and it doesn't work, thus my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess the problem comes from the 0:00:00 after the date. The problem seems to convert the datetime into a date, then applying the format is easy.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595306#M15774</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2019-10-10T10:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595307#M15775</link>
      <description>&lt;P&gt;I suggest that you try the datepart() function as follows :&lt;/P&gt;&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input date DATETIME20.;
	format date DATETIME20.;
	cards;
07MAR1996:00:00:00
	;
run;

data want;
	set have;
	format date2 ddmmyyp10.;
	date2 = datepart(date);
run;	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope this help !&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595307#M15775</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-10T10:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595312#M15777</link>
      <description>Thank you, I got the desired answer.&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595312#M15777</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2019-10-10T10:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to change a date format correctly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595314#M15779</link>
      <description>&lt;P&gt;Awesome !&lt;/P&gt;&lt;P&gt;Have a great day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-change-a-date-format-correctly/m-p/595314#M15779</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-10T10:45:54Z</dc:date>
    </item>
  </channel>
</rss>

