<?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: Select Case expression in SAS EG 5.1 Expression builder in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181608#M13894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The word Source shouldn't be in quotes AFAIK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Oct 2014 00:13:03 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-10-13T00:13:03Z</dc:date>
    <item>
      <title>Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181607#M13893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Forum, I'm out of ideas on this one. I've tried everything I can find but I'm still getting the error as shown on the attached file ... What can I do to add a new column with various conditions using the expression builder? Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="case_Expr_Error.gif" class="jive-image-thumbnail jive-image" height="499" src="https://communities.sas.com/legacyfs/online/7590_case_Expr_Error.gif" width="1419" /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11466i186CB0F216CFCB55/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="case_Expr_Error.gif" title="case_Expr_Error.gif" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2014 23:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181607#M13893</guid>
      <dc:creator>Oscarboots</dc:creator>
      <dc:date>2014-10-12T23:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181608#M13894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The word Source shouldn't be in quotes AFAIK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 00:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181608#M13894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-13T00:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181609#M13895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza, but I've tried it with, without you name it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 01:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181609#M13895</guid>
      <dc:creator>Oscarboots</dc:creator>
      <dc:date>2014-10-13T01:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181610#M13896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Couple of things&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. In SAS you refer to dates as '01Mar2009'd instead of 2009-03-01&lt;/P&gt;&lt;P&gt;2. &amp;lt;&amp;gt; is not a valid operator in SAS, it gets interpreted as max, when you probably mean NE, replace it with NE&lt;/P&gt;&lt;P&gt;3. Remove the as "Source" from the code. Notice the bracket after the calculation and the "as calculation" SAS is automatically naming it calculation. &lt;/P&gt;&lt;P&gt;I'm not sure how you're creating the case statement, it may be more helpful to show a screenshot of that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope some of the above helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 03:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181610#M13896</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-13T03:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181611#M13897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my script is;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN t1.Date_Created &amp;lt; '01Mar2009'd THEN 'Infield Sales'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN t1.SalesRepID IS NOT NULL THEN 'Infield sales'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN t1.CreatedByUserID = 1 AND t1.Date_Created &amp;gt;= '01Mar2009d' THEN 'Online'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN t1.CreatedByUserID NE 1 THEN 'CallCentre'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ELSE 'Other'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;/P&gt;&lt;P&gt;The only error I'm getting is the '&amp;lt;' comparison is on different data types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've converted the Original 'Date Time' format to 'DDMMYYN8' so it seems I now have an issue with the date Formats?&lt;/P&gt;&lt;P&gt;Thanks for your help so far Reeza, I think you've nearly got it !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 04:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181611#M13897</guid>
      <dc:creator>Oscarboots</dc:creator>
      <dc:date>2014-10-13T04:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181612#M13898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your original variable in the database is date time you'll need to convert it to a date variable first or wrap all the date_created variables in the datepart function to get just the date portion. Datepart(t1.date_created) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 04:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181612#M13898</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-13T04:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case expression in SAS EG 5.1 Expression builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181613#M13899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza, I had done the DATEPART bit but then saw that I had written the second date with the apostrophe after the 'd' instead of in front of it.&lt;/P&gt;&lt;P&gt;Now it works fine. Thanks heaps :&amp;nbsp; &amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 05:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Select-Case-expression-in-SAS-EG-5-1-Expression-builder/m-p/181613#M13899</guid>
      <dc:creator>Oscarboots</dc:creator>
      <dc:date>2014-10-13T05:00:42Z</dc:date>
    </item>
  </channel>
</rss>

