<?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 comparing dates in different formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811442#M320054</link>
    <description>&lt;PRE&gt;Service___End_Date Frequency Percent 
09JUN21:00:00:00 5 0.48 
15AUG21:00:00:00 4 0.39 
19AUG21:00:00:00 1 0.10 
30AUG21:00:00:00 1 0.10 
01SEP21:00:00:00 1 0.10 
15SEP21:00:00:00 1 0.10 
12OCT21:00:00:00 1 0.10 
29NOV21:00:00:00 1 0.10 
&lt;/PRE&gt;
&lt;P&gt;I want a statement that will delete the record if the Service___End_Date occured before today, regardless of when today is.&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2022 13:33:16 GMT</pubDate>
    <dc:creator>GreggB</dc:creator>
    <dc:date>2022-05-04T13:33:16Z</dc:date>
    <item>
      <title>comparing dates in different formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811442#M320054</link>
      <description>&lt;PRE&gt;Service___End_Date Frequency Percent 
09JUN21:00:00:00 5 0.48 
15AUG21:00:00:00 4 0.39 
19AUG21:00:00:00 1 0.10 
30AUG21:00:00:00 1 0.10 
01SEP21:00:00:00 1 0.10 
15SEP21:00:00:00 1 0.10 
12OCT21:00:00:00 1 0.10 
29NOV21:00:00:00 1 0.10 
&lt;/PRE&gt;
&lt;P&gt;I want a statement that will delete the record if the Service___End_Date occured before today, regardless of when today is.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811442#M320054</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2022-05-04T13:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: comparing dates in different formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811446#M320057</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if datepart(Service___End_Date)&amp;lt;today() then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that comparing dates is NOT (and is NEVER) a format issue. The above will work regardless of the format of variable Sevice___End_Date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is an issue that a date/time value cannot be directly compared to a date value. Date/time values are on a different scale than date values, just like Celsius is on a different scale than Fahrenheit, and you can't compare them without first doing the conversion to the other scale. That is why DATEPART is needed, to obtain a date value that can be compared to another date value TODAY(), and then they are both on the same scale. As stated, in this case, the format is irrelevant, date values can be compared to other date values.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 14:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811446#M320057</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-04T14:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: comparing dates in different formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811448#M320059</link>
      <description>&lt;P&gt;Please show what code you have tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is Service___End_Date stored in a SAS date-time variable (i.e. numeric value) or is it a character string?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's a character string, would recommend using the INPUT function to read it into a date-time variable, and then comparing the value to the current date-time (which is returned by the DATETIME function).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/comparing-dates-in-different-formats/m-p/811448#M320059</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-04T13:41:29Z</dc:date>
    </item>
  </channel>
</rss>

