<?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: DI Studio - CASE statement not working in Data Validation transformation in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235059#M5968</link>
    <description>&lt;P&gt;I can confirm what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt; is pointing at. Daata Validation is data step based transformation.&lt;/P&gt;
&lt;P&gt;So the only thin that you can isert here is an expression that is valid in a datastep assignment statment, on the right side of the = .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what you are trying to do. Dicount sounds like it would contain continues values. Invalid Values is target for situations with discrete values in a look up table. Perhaps you are better off using Custom Validation?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2015 16:32:44 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2015-11-17T16:32:44Z</dc:date>
    <item>
      <title>DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/234998#M5959</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to straighten out some faulty data with the Data Validation transformation in my ETL process.&lt;/P&gt;&lt;P&gt;I'm using the CASE expression to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My expression: CASE WHEN Discount &amp;lt; 0 THEN (Discount * (-1))&amp;nbsp; ELSE Discount END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This syntax seems to work in the SAS Enterprise Guide but it throws an error in my transformation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;2065&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;&amp;nbsp;&amp;nbsp; x_custom_rule = "";&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output etls_Exceptions;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Discount = CASE WHEN Discount&lt;BR /&gt;2065&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp; &amp;lt; 0 THEN (Discount * (-1))&amp;nbsp; ELSE Discount END;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&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;&amp;nbsp; if error_rows=0 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&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;&amp;nbsp; ____&lt;BR /&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;&amp;nbsp; 22&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;&lt;BR /&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT,&lt;BR /&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; LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really confused about this problem.&lt;/P&gt;&lt;P&gt;I'm using SAS Integration Studio 4.8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12075iCEA05019A0280E35/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="dataValidationCaseExpression.png" title="dataValidationCaseExpression.png" /&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/234998#M5959</guid>
      <dc:creator>MWest</dc:creator>
      <dc:date>2015-11-17T13:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235000#M5960</link>
      <description>&lt;P&gt;Well, I don't use DI so just some suggestions to try out:&lt;/P&gt;
&lt;P&gt;- Is discount a numeric variable&lt;/P&gt;
&lt;P&gt;- Have you replace the " &amp;lt; 0" with typed " lt 0". &amp;nbsp;I.e. replace the symbol with lt, and ensure that it is a zero type.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235000#M5960</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-17T13:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235005#M5961</link>
      <description>&lt;P&gt;Yes discount is a numeric variable.&lt;/P&gt;&lt;P&gt;Using LT instead of &amp;lt; makes no difference, the error is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what do you mean by zero type? It is a proper zero not an O or anything if that's what you mean.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235005#M5961</guid>
      <dc:creator>MWest</dc:creator>
      <dc:date>2015-11-17T13:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235007#M5962</link>
      <description>&lt;P&gt;Yes, I meant a zero. &amp;nbsp;They are all the things I could think of just from a coding point of view, must something in DI as the code would be fine then. &amp;nbsp;Sorry, can't be of more use.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 13:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235007#M5962</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-11-17T13:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235013#M5963</link>
      <description>&lt;P&gt;I don't use DI either, but your code snippet looks like you're mixing PROC SQL code ("CASE WHEN ...") with DATA step code ("if ... then do; ..."). I'd suggest you replace your CASE WHEN ... END expression by one of the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;abs(Discount)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="line-height: 20px;"&gt;ifn(&lt;SPAN&gt;Discount&lt;/SPAN&gt;&amp;lt;0, -&lt;SPAN&gt;Discount&lt;/SPAN&gt;,&amp;nbsp;&lt;SPAN&gt;Discount&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 14:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235013#M5963</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-17T14:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235059#M5968</link>
      <description>&lt;P&gt;I can confirm what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt; is pointing at. Daata Validation is data step based transformation.&lt;/P&gt;
&lt;P&gt;So the only thin that you can isert here is an expression that is valid in a datastep assignment statment, on the right side of the = .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what you are trying to do. Dicount sounds like it would contain continues values. Invalid Values is target for situations with discrete values in a look up table. Perhaps you are better off using Custom Validation?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 16:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235059#M5968</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-11-17T16:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235207#M5994</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;: I don't know about when to use the PROC SQL and when to use the DATA step code. I'm using the Expression Builder of DI Studio and there this function is available for use (see attachment). So I'm not sure why they would list a function that doesn't work.&lt;BR /&gt;Your solution with abs(Discount) serves my purpose though. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt;: What I'm trying to do is adjusting invalid values only if they fulfill certain criteria.&lt;/P&gt;&lt;P&gt;In my case i want to make the Discount a positive value in case somebody registered a negative value. For this purpose I can use the abs() function as stated by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;. But I'm not sure how one is supposed to do this with more complex corrections when there is no conditional logic available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12077iCAF5BCFF895FCDB2/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="expressionBuilder.png" title="expressionBuilder.png" /&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235207#M5994</guid>
      <dc:creator>MWest</dc:creator>
      <dc:date>2015-11-18T12:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235208#M5995</link>
      <description>&lt;P&gt;As I said in my previous post, Custom Validation gives you the ability to do conditional logic, but not SQL case expressions.&lt;/P&gt;
&lt;P&gt;The code you insert must work in a data step. Try to fill in some code. Then switch to the "Code" tab, and see how your code snippet is inserted in the Transformation generated code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't get your logic into the Data Validation transformation, use other transformations.&lt;/P&gt;
&lt;P&gt;If you nee to use case expressions, Extract and Join transformations will work.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235208#M5995</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-11-18T12:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235223#M6000</link>
      <description>&lt;P&gt;Since I've never used DI studio, I can only guess. I take it that there must be some place in DI Studio where CASE expressions are valid, but the "New Value" field in the "Invalid Values" dialog box does not seem to be such a place. The code typed in there appears to be included into what looks like DATA step code. The first two error messages that you got (388-185 and 202-322) are exactly the same that I get if I try to assign a CASE expression to a variable in a DATA step. Indeed, "New Value" sounds to me more like a literal value or an expression using operators or functions.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235223#M6000</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-18T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio - CASE statement not working in Data Validation transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235235#M6001</link>
      <description>&lt;P&gt;I guess that's it. Thank you guys for clearing this issue up!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 14:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-CASE-statement-not-working-in-Data-Validation/m-p/235235#M6001</guid>
      <dc:creator>MWest</dc:creator>
      <dc:date>2015-11-18T14:12:39Z</dc:date>
    </item>
  </channel>
</rss>

