<?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 Easy : How to compare date field to fixed date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332237#M22050</link>
    <description>&lt;P&gt;This is easy but I am struggling with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field t1.TrnDt is a date but the following syntax gives an error. &amp;nbsp;I am try to create a new computed column. &amp;nbsp;What's wrong with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CASE &amp;nbsp;WHEN &amp;nbsp; t1.TrnDt &amp;gt; &amp;nbsp;"01/01/2011" THEN "Late" &amp;nbsp;ELSE &amp;nbsp;"Early" &amp;nbsp; END&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Feb 2017 16:32:57 GMT</pubDate>
    <dc:creator>PadraigODea</dc:creator>
    <dc:date>2017-02-13T16:32:57Z</dc:date>
    <item>
      <title>Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332237#M22050</link>
      <description>&lt;P&gt;This is easy but I am struggling with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field t1.TrnDt is a date but the following syntax gives an error. &amp;nbsp;I am try to create a new computed column. &amp;nbsp;What's wrong with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CASE &amp;nbsp;WHEN &amp;nbsp; t1.TrnDt &amp;gt; &amp;nbsp;"01/01/2011" THEN "Late" &amp;nbsp;ELSE &amp;nbsp;"Early" &amp;nbsp; END&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332237#M22050</guid>
      <dc:creator>PadraigODea</dc:creator>
      <dc:date>2017-02-13T16:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332241#M22051</link>
      <description>&lt;P&gt;SAS requires literal dates in the form of ddMONyy or ddMONyyyy, in quotes and followed by D to indicate date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CASE &amp;nbsp;WHEN &amp;nbsp; t1.TrnDt &amp;gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;'01Jan2011'd ....&lt;/P&gt;
&lt;P&gt;You can use '1Jan2011'd but I generally use the 01Jan so I know I didn't actually mean 10Jan and just missed a digit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are similar rules for Time or DATETIME literals.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332241#M22051</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-13T16:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332245#M22052</link>
      <description>&lt;P&gt;Easy when you know how !! &amp;nbsp;Thanks again.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332245#M22052</guid>
      <dc:creator>PadraigODea</dc:creator>
      <dc:date>2017-02-13T16:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332255#M22053</link>
      <description>&lt;P&gt;Aaagh! &amp;nbsp;I spoke too soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following date (cut and pasted from SAS)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;t1.TrnDt = 12JUN2007:00:00:00.000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above date gives an "After" result to the following calculated field;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;CASE WHEN &amp;nbsp;t1.TrnDt &amp;gt;= &amp;nbsp;'01Jan2011'd &amp;nbsp; &amp;nbsp; &amp;nbsp;THEN "After" ELSE &amp;nbsp;"Before" END&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But surely 2007 is BEFORE 2011 ??? &amp;nbsp; Why does my case statement fail??&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 17:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332255#M22053</guid>
      <dc:creator>PadraigODea</dc:creator>
      <dc:date>2017-02-13T17:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332259#M22055</link>
      <description>&lt;P&gt;The value 12JUN2007:00:00:00.000 is a DATETIME value. SAS datetimes are counts of seconds and SAS dates are counts of days.&lt;/P&gt;
&lt;P&gt;So either use something like "12JUN2007:00:00:00"DT OR compare the datetpart of the value to literal, which would probably be your intention:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CASE WHEN &amp;nbsp;datepart(t1.TrnDt) &amp;nbsp;&amp;gt;= &amp;nbsp;'01Jan2011'd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;one of my pet peeves are programmers that call datetime values dates or follow what seems to be a Microslop approach of defaulting things to datetime when you actually want dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 17:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332259#M22055</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-13T17:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Easy : How to compare date field to fixed date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332261#M22057</link>
      <description>Thanks - That's it. Much appreciated.</description>
      <pubDate>Mon, 13 Feb 2017 17:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Easy-How-to-compare-date-field-to-fixed-date/m-p/332261#M22057</guid>
      <dc:creator>PadraigODea</dc:creator>
      <dc:date>2017-02-13T17:12:35Z</dc:date>
    </item>
  </channel>
</rss>

