<?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: Format dates in a unique format in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Format-dates-in-a-unique-format/m-p/840087#M36405</link>
    <description>&lt;P&gt;The only way this question makes any sense is if the variable is a character string instead of a DATE.&amp;nbsp; (SAS stores dates as number of days since 1960).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those strings are all supposed to represent day, month, and year values then you can use the DDMMYY informat to convert the string into a date value.&amp;nbsp; You could then leave it as a numeric value and apply any date type FORMAT to it you want.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
   date = input(date_string,ddmmyy10.);
   format date yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could use the PUT() function to use the format to generate a new character string.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then if you want you could overwrite the original character variable's vlaue.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
   date_string = put(input(date_string,ddmmyy10.),yymmdd10.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NOTE: I have used the YYMMDD format in my code so that the dates will be displayed in Year, Month, Day order.&amp;nbsp; If you display dates in DMY or MDY order you will confuse 50% of your audience.&amp;nbsp; If you really insist on seeing the dates in dd/mm/yyyy style then just use the DDMMYYS10. format instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Oct 2022 14:06:18 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-22T14:06:18Z</dc:date>
    <item>
      <title>Format dates in a unique format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-dates-in-a-unique-format/m-p/840084#M36404</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data set with dates in really really all types of "formats" like:&lt;/P&gt;
&lt;P&gt;01/1/2001, 1/1/2001, 1/01/2001, 1/1/00, 01/1/00, 1/01/00. Is there a quick way to format all these exceptions in dd/mm/yyyy?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much. If I use for example: format date*, does it will take all the exceptions? The records are really many and so I cannot check for each single case. I must be sure that all the dates are in the same file format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 13:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-dates-in-a-unique-format/m-p/840084#M36404</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2022-10-22T13:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Format dates in a unique format</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-dates-in-a-unique-format/m-p/840087#M36405</link>
      <description>&lt;P&gt;The only way this question makes any sense is if the variable is a character string instead of a DATE.&amp;nbsp; (SAS stores dates as number of days since 1960).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those strings are all supposed to represent day, month, and year values then you can use the DDMMYY informat to convert the string into a date value.&amp;nbsp; You could then leave it as a numeric value and apply any date type FORMAT to it you want.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
   date = input(date_string,ddmmyy10.);
   format date yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could use the PUT() function to use the format to generate a new character string.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then if you want you could overwrite the original character variable's vlaue.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
   date_string = put(input(date_string,ddmmyy10.),yymmdd10.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NOTE: I have used the YYMMDD format in my code so that the dates will be displayed in Year, Month, Day order.&amp;nbsp; If you display dates in DMY or MDY order you will confuse 50% of your audience.&amp;nbsp; If you really insist on seeing the dates in dd/mm/yyyy style then just use the DDMMYYS10. format instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 14:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-dates-in-a-unique-format/m-p/840087#M36405</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-22T14:06:18Z</dc:date>
    </item>
  </channel>
</rss>

