<?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: Help formatting dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991573#M380357</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;will Proc compare treat two identical date values in different formats as equal?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It will just mention the &lt;EM&gt;format&lt;/EM&gt; difference in the output, but treat the &lt;EM&gt;values&lt;/EM&gt; as equal.&lt;/P&gt;
&lt;PRE&gt;...
Number of Variables with &lt;STRONG&gt;Differing Attributes&lt;/STRONG&gt;: 1.


&lt;FONT color="#3366FF"&gt;Listing of Common Variables with Differing Attributes

Variable  Dataset    Type  Length  Format&lt;/FONT&gt;

date      WORK.WANT  Num        8  DATE11.
          WORK.HAVE  Num        8  MMDDYY10.
...
Number of Observations with All Compared Variables Equal: 1.

&lt;FONT color="#3366FF"&gt;NOTE: No unequal values were found. All &lt;STRONG&gt;values compared are exactly equal&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 31 Jul 2026 16:24:08 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2026-07-31T16:24:08Z</dc:date>
    <item>
      <title>Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991558#M380347</link>
      <description>I need help.  I imported an excel file with a date which shows as 07/31/2026 in the data after import.   It is in numeric date format.   I want it as 31-JUL-2026.   I’ve tried input(date, date11.). But that returns null.  Ive tried format date date11. But they still display as 07/31/2026.  How can I get them as 31-JUL-2026?</description>
      <pubDate>Fri, 31 Jul 2026 13:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991558#M380347</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2026-07-31T13:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991564#M380349</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your suggested FORMAT statement should work in a DATA step and also in a PROC DATASETS step as shown below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create sample data for demonstration */

data have;
date='31JUL2026'd;
format date mmddyy10.;
run;

/* Change the date format */

proc datasets lib=work nolist;
modify have;
format date date11.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Replace &lt;FONT face="courier new,courier"&gt;work&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;have&lt;/FONT&gt; with your libref and dataset name, respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your code doesn't change the format, please post the log (using the "Insert Code" button).&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2026 15:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991564#M380349</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2026-07-31T15:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991568#M380352</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; How about this?&lt;BR /&gt;&lt;BR /&gt;DATA example;&lt;BR /&gt;d = INPUT("07/31/2026", mmddyy10.);&lt;BR /&gt;FORMAT d date11.;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2026 16:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991568#M380352</guid>
      <dc:creator>byhal</dc:creator>
      <dc:date>2026-07-31T16:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991569#M380353</link>
      <description>Thanks. I have a followup question: will Proc compare treat two identical date values in different formats as equal?</description>
      <pubDate>Fri, 31 Jul 2026 16:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991569#M380353</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2026-07-31T16:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991570#M380354</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I need help. I imported an excel file with a date which shows as 07/31/2026 in the data after import. It is in numeric date format. I want it as 31-JUL-2026. I’ve tried input(date, date11.). But that returns null. Ive tried format date date11. But they still display as 07/31/2026. How can I get them as 31-JUL-2026?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;INPUT() is used with an INFORMAT to convert text into values.&amp;nbsp; It will not work properly with a numeric variable since SAS will first have to convert the number into some text since that is what the INPUT() function needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable is numeric with the MMDDYY10. format attached so the values print in the mm/dd/yyyy style you show then just change it so that the variable has the DATE11. format attached to it so the dates print in the dd-MMM-yyyy style you want.&amp;nbsp; So just use a FORMAT statement as part of another data step (or as part of PROC MODIFY code to change the format attached to the current variable).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format date date11.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the variable is character then you could either make a new numeric variable and attach the desired format to it.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdate = input(date,mmddyy10.);
format newdate date11.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or make a new character variable with the dates in the style you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdate=put(input(date,mmddyy10.),date11.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jul 2026 16:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991570#M380354</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-07-31T16:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991571#M380355</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks. I have a followup question: will Proc compare treat two identical date values in different formats as equal?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes.&amp;nbsp; The value stored is not impacted by the method you have attached for how to display the value.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2026 16:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991571#M380355</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-07-31T16:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991573#M380357</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;will Proc compare treat two identical date values in different formats as equal?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It will just mention the &lt;EM&gt;format&lt;/EM&gt; difference in the output, but treat the &lt;EM&gt;values&lt;/EM&gt; as equal.&lt;/P&gt;
&lt;PRE&gt;...
Number of Variables with &lt;STRONG&gt;Differing Attributes&lt;/STRONG&gt;: 1.


&lt;FONT color="#3366FF"&gt;Listing of Common Variables with Differing Attributes

Variable  Dataset    Type  Length  Format&lt;/FONT&gt;

date      WORK.WANT  Num        8  DATE11.
          WORK.HAVE  Num        8  MMDDYY10.
...
Number of Observations with All Compared Variables Equal: 1.

&lt;FONT color="#3366FF"&gt;NOTE: No unequal values were found. All &lt;STRONG&gt;values compared are exactly equal&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Jul 2026 16:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991573#M380357</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2026-07-31T16:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991612#M380364</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks. I have a followup question: will Proc compare treat two identical date values in different formats as equal?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes.&amp;nbsp; The value stored is not impacted by the method you have attached for how to display the value.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An anecdote from data imported from Excel: I have had values that appeared as dates in Excel that had a decimal component that was kept on import. Since the SAS date formats only use the the integer portion you might not see that decimal bit until you try to match the dates and get unexpected results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IIRC this occurred with an Excel column that contained mixed date only values and datetime values as Excel uses the decimal portion to store time of day information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2026 22:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-formatting-dates/m-p/991612#M380364</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-07-31T22:13:20Z</dc:date>
    </item>
  </channel>
</rss>

