<?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 Syntax help for Case statement in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48974#M471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Can you post some thing like what you have in the data and what you want? It would be easy to resolve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Mar 2012 18:11:45 GMT</pubDate>
    <dc:creator>Hima</dc:creator>
    <dc:date>2012-03-29T18:11:45Z</dc:date>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48973#M470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using SAS Enterprise Guide.&amp;nbsp; I have a Data Column I want to create but not sure of the syntax.&lt;/P&gt;&lt;P&gt;The gist of what I want to do is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max(if([Line_Code]=1,[Provision_Detail],Null)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would I do this in SAS Enterprise Guide.&amp;nbsp; What would be the correct syntax?&amp;nbsp; I tried the CASE statement but I get errors.&amp;nbsp; It doesn't seem to like MAX and NULL.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 17:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48973#M470</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-03-29T17:38:36Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48974#M471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Can you post some thing like what you have in the data and what you want? It would be easy to resolve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 18:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48974#M471</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-03-29T18:11:45Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48975#M472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; What I posted is what I want - this is the syntax in Microsoft Access.&amp;nbsp; I need to know what the syntax would be in SAS Enterprise Guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿Max(iif([Line_Code] = 1, [Provision_Detail],Null)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a calculated column with the above only in SAS Enterprise Guide terms.&amp;nbsp; &lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 18:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48975#M472</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-03-29T18:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48976#M473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I dont know MS Access but if I understand the syntax iif([Line_Code] = 1, [Provision_Detail],Null as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if Line_Code = 1 then return Provision_Detail&lt;/P&gt;&lt;P&gt;otherwise return null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data table1; ** Want Table **;&lt;/P&gt;&lt;P&gt;set table2; ** HaveTable **;&lt;/P&gt;&lt;P&gt;if&amp;nbsp; Line_Code = 1 then Var=Provision_Detail;&lt;/P&gt;&lt;P&gt;else Var= 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did not get the max part, can you explain that? So I can post the remaining code but the code above works fine with out max function assuming that I got MS Access syntax correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 18:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48976#M473</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-03-29T18:27:00Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48977#M474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; That doesn't look like something for Enterprise Guide.&lt;/P&gt;&lt;P&gt;I am looking for a case statement like&lt;/P&gt;&lt;P&gt;MAX CASE&lt;/P&gt;&lt;P&gt;When Line_Order = 1 then Provision_Detail&lt;/P&gt;&lt;P&gt;Else " "&lt;/P&gt;&lt;P&gt;End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't know the correct syntax for SAS Enterprise Guide&lt;/P&gt;&lt;P&gt;I am trying to create a calculated column&lt;/P&gt;&lt;P&gt;There is a CASE {Else} function in Enterprise Guide&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I am trying to do that works in Access and Cognos is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Provision_Detail field has multiple lines.&amp;nbsp; I am trying to get the multple lines to go across instead of down.&amp;nbsp; According to the line order (1-9).&amp;nbsp; If the line order is 1, the above code will put it in the first column.&amp;nbsp; I am going to create a calculation for each line code (1-9).&amp;nbsp; I really need to know how to do this in Enterprise Guide.&amp;nbsp; Maybe I am in the wrong forum.&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;/P&gt;&lt;P&gt;&lt;/P&gt;﻿﻿﻿&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 18:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48977#M474</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-03-29T18:53:42Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48978#M475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code has been tested in EG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;INPUT LINE_ORDER&amp;nbsp; PROVISION_DETAIL;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 100&lt;BR /&gt;2 200&lt;BR /&gt;3 300&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC PRINT; RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE TEMP AS SELECT CASE WHEN LINE_ORDER = 1 THEN PROVISION_DETAIL ELSE 0 END AS VARIABLE_NAME FROM TEST;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;SELECT MAX(VARIABLE_NAME) FROM TEMP;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code can be done in Base SAS. Tested in EG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;BR /&gt;INPUT LINE_ORDER&amp;nbsp; PROVISION_DETAIL;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 100&lt;BR /&gt;2 200&lt;BR /&gt;3 300&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC PRINT; RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA TEMP;&lt;BR /&gt;SET TEST;&lt;BR /&gt;IF LINE_ORDER = 1 THEN VARIABLE_NAME = PROVISION_DETAIL;&lt;BR /&gt;ELSE VARIABLE_NAME = 0;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC MEANS DATA =TEMP MAX;&lt;BR /&gt;VAR VARIABLE_NAME;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 19:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48978#M475</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-03-29T19:03:18Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48979#M476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to do what Hima suggested and post what you have and what you want. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS processes data differently (line by line) than Cognos or SQL (by dataset) though you can incorporate that in. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;From you single line of code what Hima has suggested should work if you are doing it via code. If you're doing it via an interface in EG ie Query Builder,&amp;nbsp; you'd need to state which one and which version you're using.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 19:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48979#M476</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-03-29T19:44:48Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48980#M477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; The version of Enterprise Guide I am using is 4.1(4.1.0.472).&amp;nbsp; I really am not that familiar with regular SAS.&amp;nbsp; We are just learning how to use Enterprise Guide.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 10:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48980#M477</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-03-30T10:11:27Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48981#M478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Is there a forum just for enterprise Guide questions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 10:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48981#M478</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-03-30T10:35:40Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48982#M479</link>
      <description>&lt;P&gt;There is actually a forum for Enterprise Guide; it is SAS Enterprise Guide under SAS Programming and Reporting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason for some of the confusion in responses to you is that SAS has a programming language, which is used in a SAS data step. However, you are using the Query Builder in Enterprise Guide, which uses SQL instead of the data step programming language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following might help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. In the query builder, build a new Computed Column, and within that use the Expression Builder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. As your expression, type or use the point-and-click features to create code that looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CASE WHEN Line_Code = 1 THEN Provision_Detail ELSE . END&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(or you can just copy and paste it from here). Note the . (dot) after the ELSE; that represents a SAS missing value, the equivalent of a SQL NULL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the way out of the expression builder, give the new variable a name, say Result1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now do the same to create Result2 and Result3, just changing the 1 after "WHEN Line_Code = 1" to 2 and 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I preview the code of my query builder, it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;CREATE TABLE SASUSER.Query_for_TEST AS SELECT TEST.Line_Code,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TEST.Provision_Detail,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (CASE WHEN Line_Code = 1 THEN Provision_Detail ELSE . END) AS Result1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (CASE WHEN Line_Code = 2 THEN Provision_Detail ELSE . END ) AS Result2,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (CASE WHEN Line_Code = 3 THEN Provision_Detail ELSE . END ) AS Result3&lt;/P&gt;
&lt;P&gt;FROM WORK.TEST AS TEST;&lt;/P&gt;
&lt;P&gt;QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And my test results look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 240pt; border-collapse: collapse;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP span="1"&gt;&lt;COL style="width: 48pt;" span="5" width="64" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD width="64" height="18" style="width: 48pt; height: 13.2pt;"&gt;Line_Code&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Provision_Detail&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Result1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Result2&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Result3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD height="18" align="right" style="height: 13.2pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;11&lt;/TD&gt;
&lt;TD align="right"&gt;11&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD height="18" align="right" style="height: 13.2pt;"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD height="18" align="right" style="height: 13.2pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;13&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right"&gt;13&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD height="18" align="right" style="height: 13.2pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;14&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 13.2pt;"&gt;
&lt;TD height="18" align="right" style="height: 13.2pt;"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;15&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, you can add as many result variables as you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this going in the direction you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is to use the Data | Transpose task. It is designed to move data from a row orientation to a column orientation very easily, but it depends on whether it matches what you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Editor's note: This is the marked solution because it shows how to express a CASE statement in SAS Enterprise Guide.&amp;nbsp; The original poster had deeper questions, but this should help most readers of this topic.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 15:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48982#M479</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-12-13T15:52:10Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48983#M480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; That is the direction but instead of each result going 1 step down, it should go straight across forming one row.&amp;nbsp; That is where the MAX statement comes in.&amp;nbsp; That is how it works in ACCESS and Cognos.&amp;nbsp; I am trying to get it to work in SAS because we want to convert a lot of our ACCESS to SAS.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 10:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48983#M480</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-02T10:17:05Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48984#M481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;NOW I understand what the MAX was for!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No problem. Just change each of&amp;nbsp; your equations from step 2 to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAX(CASE WHEN Line_Code = 1 THEN Provision_Detail ELSE . END)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and make sure you don't have any results in your query except for Result1 through Resultn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My results look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 144pt; border-collapse: collapse;" width="192"&gt;&lt;TBODY&gt;&lt;TR style="height: 13.2pt;"&gt;&lt;TD height="18" style="width: 48pt; height: 13.2pt;" width="64"&gt;Result1&lt;/TD&gt;&lt;TD style="width: 48pt;" width="64"&gt;Result2&lt;/TD&gt;&lt;TD style="width: 48pt;" width="64"&gt;Result3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 13.2pt;"&gt;&lt;TD align="right" height="18" style="height: 13.2pt;"&gt;11&lt;/TD&gt;&lt;TD align="right"&gt;12&lt;/TD&gt;&lt;TD align="right"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 03:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48984#M481</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2012-04-03T03:07:14Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48985#M482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am getting the following errors when I use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND MAX(CASE WHEN V_MKTDEC_PROVISIONS.LINE_ORDER = 1 &lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN V_MKTDEC_PROVISIONS.PROVISION_DETAIL &lt;/P&gt;&lt;P&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE . END) &lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; ERROR: Result of WHEN clause 2 is not the same data type as the preceding results. ERROR: Summary functions are restricted to the SELECT and HAVING clauses only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using Enterprise Guide 4.1&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 11:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48985#M482</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-03T11:48:20Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48986#M483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats because you are code doesn't have GROUP BY. When you use aggregate functions, GROUP BY must be used in the syntax. Please refer to the below link for further details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.techonthenet.com/sql/group_by.php"&gt;http://www.techonthenet.com/sql/group_by.php&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 12:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48986#M483</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-04-03T12:10:06Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48987#M484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this is how you want to see your results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt; &lt;/DIV&gt; &lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;COLGROUP span="1"&gt;&lt;COL span="5" width="64" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" colspan="2" height="17" width="128"&gt;&lt;SPAN style="font-size: 8pt;"&gt;PROVISION_&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17"&gt;Line_Code&lt;/TD&gt;&lt;TD&gt;DETAIL&lt;/TD&gt;&lt;TD&gt;Result1&lt;/TD&gt;&lt;TD&gt;Result2&lt;/TD&gt;&lt;TD&gt;Result3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" colspan="5" height="17"&gt;ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;100&lt;/TD&gt;&lt;TD align="right"&gt;100&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;200&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;200&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;300&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code would be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿DATA TEST;&lt;BR /&gt;INPUT Line_Code&amp;nbsp; PROVISION_DETAIL;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 100&lt;BR /&gt;2 200&lt;BR /&gt;3 300&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;SELECT TEST.Line_Code,&lt;/P&gt;&lt;P&gt;&amp;nbsp; TEST.Provision_Detail,&lt;/P&gt;&lt;P&gt;&amp;nbsp; max(CASE WHEN Line_Code = 1 THEN Provision_Detail ELSE . END) AS Result1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; max(CASE WHEN Line_Code = 2 THEN Provision_Detail ELSE . END ) AS Result2,&lt;/P&gt;&lt;P&gt;&amp;nbsp; max(CASE WHEN Line_Code = 3 THEN Provision_Detail ELSE . END ) AS Result3 &lt;/P&gt;&lt;P&gt;FROM WORK.TEST AS TEST&lt;BR /&gt;group by Line_Code;&lt;/P&gt;&lt;P&gt;QUIT;&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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 12:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48987#M484</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-04-03T12:29:21Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48988#M485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I grouped by in Enterprise Guide but I am still getting errors.&amp;nbsp; I am beginning to think this can't be done in Enterprise Guide.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 12:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48988#M485</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-03T12:33:13Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48989#M486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please post the complete code and log so it would be easy to resolve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 12:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48989#M486</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-04-03T12:34:52Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48990#M487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I'm not sure why you have an AND in the snippet you provided. You definitely don't need a GROUP BY. Your three expressions should be independent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code I used to generate the data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.test;&lt;/P&gt;&lt;P&gt;Line_Code = 1; Provision_Detail = 11; output;&lt;/P&gt;&lt;P&gt;Line_Code = 2; Provision_Detail = 12; output;&lt;/P&gt;&lt;P&gt;Line_Code = 3; Provision_Detail = 13; output;&lt;/P&gt;&lt;P&gt;Line_Code = 4; Provision_Detail = 14; output;&lt;/P&gt;&lt;P&gt;Line_Code = 5; Provision_Detail = 15; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the query builder GUI to build the example I've been presenting, but here's the code that EG generates. I think if you run the code above, and then this, in a code window, you'll get the same results I did&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE SASUSER.QUERY_FOR_TEST_0000 AS&lt;/P&gt;&lt;P&gt;SELECT (MAX(CASE WHEN Line_Code = 1 THEN Provision_Detail ELSE . END)) AS Result1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (MAX(CASE WHEN Line_Code = 2 THEN Provision_Detail ELSE . END)) AS Result2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (MAX(CASE WHEN Line_Code = 3 THEN Provision_Detail ELSE . END)) AS Result3 &lt;/P&gt;&lt;P&gt;FROM WORK.TEST AS TEST;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep at it; you're very close!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 22:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48990#M487</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2012-04-03T22:00:40Z</dc:date>
    </item>
    <item>
      <title>Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48991#M488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; The AND is the result of other filters in the code.&amp;nbsp; The Provision Detail is lines of text per group.&amp;nbsp; Each line of text creates another record.&amp;nbsp; The reason I need to take the Provision Detail and put it going across is because if it was left as is (going down) then that increases the size of the file exponentially.&amp;nbsp; Instead of each group having one record, it would have 1-15 records for each group according to how many lines of text in the Provision Detail field.&amp;nbsp; The Line_Order field counts the number of lines of text.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 10:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48991#M488</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-04T10:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax help for Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48992#M489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am close, maybe close in finding I can't do this.&amp;nbsp; I am getting the following error in Enterprise Guide 4.1 NOTE: The query requires remerging summary statistics back with the original data. ERROR: ORACLE execute error: ORA-01652: unable to extend temp segment by 128 in tablespace TMP_01. NOTE: Table WORK.QUERY_FOR_V_MKTDEC_PROVISIONS created, with 0 rows and 13 columns. I am using the following&amp;nbsp; code to create a computed column MAX(CASE When V_MKTDEC_PROVISIONS.LINE_ORDER = 1 Then V_MKTDEC_PROVISIONS.PROVISION_DETAIL ELSE " " END) It wouldn't accept the . so I used " " and it didn't give me an error.&amp;nbsp; I am only testing on 1 record but it doesn't bring back anything.&amp;nbsp; This is a hugh table that I am trying to query. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it to work.&amp;nbsp; What was causing the problem was my filtering for the dates.&amp;nbsp; I removed the filter for the dates and got results and the (﻿﻿MAX(CASE When V_MKTDEC_PROVISIONS.LINE_ORDER = 1 Then V_MKTDEC_PROVISIONS.PROVISION_DETAIL ELSE " " END) worked perfectly.&amp;nbsp; ﻿ I still need to figure out what syntax I can use for the following pseudo code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effective_From_Date &amp;lt;= todays date - I need a function for todays date.&amp;nbsp; I was using TODAY() and DATE() but it didn't like those options.&lt;/P&gt;&lt;P&gt;I also have &lt;/P&gt;&lt;P&gt;Effective_to_date is missing or Effective_to_date &amp;gt;= today's date - same problem - I need a function to filter the date fields.&amp;nbsp; Do I need to convert the date fields to some date format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Syntax-help-for-Case-statement/m-p/48992#M489</guid>
      <dc:creator>lloraine</dc:creator>
      <dc:date>2012-04-04T16:19:29Z</dc:date>
    </item>
  </channel>
</rss>

