<?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: Comparing dates in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141797#M28463</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha the general syntax for a date delimiter in sas HAS TO BE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DD Mon YYYY (no spaces).&amp;nbsp; Note I say Mon, meaning the character representation of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so&lt;/P&gt;&lt;P&gt;05/01/2011 would HAVE to be 05Jan2001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sas does this because in different countries in the world, there is NOT a consistent way to format dates. Example in the US dates are in&amp;nbsp; MM/DD/YYYY, however in many parts of europe it is DD/MM/YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO the field 05/01/2011 means May 1st 2011 in the US, however it means January 5th 2011 in other parts of the world.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jun 2014 14:10:56 GMT</pubDate>
    <dc:creator>Anotherdream</dc:creator>
    <dc:date>2014-06-13T14:10:56Z</dc:date>
    <item>
      <title>Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141795#M28461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to determine if the dates in a variable are GE a specific date value and LE another date value (in bold). I have tried variations of the below and keep getting errors. Any syntax ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data s1suffolkpre;&lt;/P&gt;&lt;P&gt;set s1;&lt;/P&gt;&lt;P&gt;if cnty_name="Suffolk";&lt;/P&gt;&lt;P&gt;format start mmddyy10.;&lt;/P&gt;&lt;P&gt;format stop mmddyy10.;&lt;/P&gt;&lt;P&gt;format filing1 mmddyy10.;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if filing1 ge '01/01/2008'd and filing1 le '12/31/2009'd; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 13:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141795#M28461</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2014-06-13T13:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141796#M28462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might try using '01Jan2008'd and '31Dec2009'd...if that doesn't work...you'll probably need to post some examples and the error message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 13:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141796#M28462</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2014-06-13T13:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141797#M28463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha the general syntax for a date delimiter in sas HAS TO BE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DD Mon YYYY (no spaces).&amp;nbsp; Note I say Mon, meaning the character representation of the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so&lt;/P&gt;&lt;P&gt;05/01/2011 would HAVE to be 05Jan2001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sas does this because in different countries in the world, there is NOT a consistent way to format dates. Example in the US dates are in&amp;nbsp; MM/DD/YYYY, however in many parts of europe it is DD/MM/YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO the field 05/01/2011 means May 1st 2011 in the US, however it means January 5th 2011 in other parts of the world.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 14:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141797#M28463</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-06-13T14:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141798#M28464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both--that worked. However, my format statements preceding the comparison statement both reference a date format of mm/dd/yyyy (format filing1 mmddyy10.;). This apparently is not an issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 14:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141798#M28464</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2014-06-13T14:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141799#M28465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Short answer No.&lt;/P&gt;&lt;P&gt;Longer answer; Do a bit more research into Dates in Sas, and the date literal (that's what you're doing when you call 'DDMonYYYY'd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A FORMAT statement only affects the way the data is displayed, not how it is handled by the system. Remember all "dates" in sas are really numbers (they're the number of days between 1/1/1960 and your input date).&amp;nbsp; Try to format one of your dates as best12. to see what I mean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As such, you're basically telling sas "show my dates in the format mmddyyyy10.", however they're REALLY a number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHen you do the date literal of "01Jan2008"d you're telling sas "I DON'T KNOW the numeric value for the date January 1st 2008, so please take this input string and convert it to that number for me". Then compare THAT NUMBER against my date field, and apply my other logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can format a date ANY way you want, but it doesn't change how sas "handles" the date, only how it displays it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 14:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141799#M28465</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-06-13T14:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing dates in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141800#M28466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that's fine. I didn't know dates were just a display. Thanks a lot (again)!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 18:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-dates-in-SAS/m-p/141800#M28466</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2014-06-13T18:02:32Z</dc:date>
    </item>
  </channel>
</rss>

