<?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 If date var. ge specific date... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180421#M265072</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a date variable which I'd like to use as a cut-off to select a set of observations (i.e. exclude all observations after 02/28/2013). The cut-off date will change when I run the program again in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the best way to do this in SAS given the date is stored as the number of days since 1/1/1960?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be to create a variable which will convert my cut-off date to the number of days since 1/1/1960?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Jan 2015 18:26:03 GMT</pubDate>
    <dc:creator>Maisha_Huq</dc:creator>
    <dc:date>2015-01-13T18:26:03Z</dc:date>
    <item>
      <title>If date var. ge specific date...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180421#M265072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a date variable which I'd like to use as a cut-off to select a set of observations (i.e. exclude all observations after 02/28/2013). The cut-off date will change when I run the program again in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the best way to do this in SAS given the date is stored as the number of days since 1/1/1960?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be to create a variable which will convert my cut-off date to the number of days since 1/1/1960?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180421#M265072</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-01-13T18:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: If date var. ge specific date...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180422#M265073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As long as your dates are SAS dates (numeric, with date format) SAS can compare dates logically. &lt;/P&gt;&lt;P&gt;Store your reference date as a macro variable and use that in the comparison:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let cutoff_date="01Jan2015"d;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if date &amp;lt;= &amp;amp;cutoff_date then ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180422#M265073</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-13T18:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: If date var. ge specific date...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180423#M265074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple of additional considerations ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is possible your DATE variable will have a missing value, be sure to code for that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (. &amp;lt; date &amp;lt;= &amp;amp;cutoff_date);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if your cutoff date has a pattern to it, you may be able to omit macro language entirely.&amp;nbsp; For example, suppose if you run the program in February you would like to include all dates before February 1 and exclude those from February 1 onward.&amp;nbsp; You could code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (. &amp;lt; date &amp;lt; intnx('month', today(), 0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Under those conditions, you wouldn't need to modify the program at all in the future.&amp;nbsp; The cutoff date would adjust automatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 19:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180423#M265074</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-01-13T19:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: If date var. ge specific date...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180424#M265075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both so much.&amp;nbsp; That helps, would ve liked to mark both "Correct"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jan 2015 19:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-date-var-ge-specific-date/m-p/180424#M265075</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-01-13T19:21:19Z</dc:date>
    </item>
  </channel>
</rss>

