<?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: CASE Statement Not Working in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252865#M6827</link>
    <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: the column name is defined in the transformation Metadata. Thus, it's not specified in the expression. This way, you can quite easily change column definition in a whole program flow via a single point and click operation without having to change expressions.</description>
    <pubDate>Fri, 26 Feb 2016 23:27:12 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-02-26T23:27:12Z</dc:date>
    <item>
      <title>CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252807#M6817</link>
      <description>&lt;P&gt;I'm trying to create a CASE statement in the Target Table within a job in DI Studio. &amp;nbsp;The field being referenced from the Source Table is a Character Type. &amp;nbsp;My CASE statement is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE WHEN PIFSTOP &amp;nbsp;= 0 THEN '' ELSE 'C' END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems like a fairly straight forward Expression, but with no luck.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 20:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252807#M6817</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-26T20:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252813#M6818</link>
      <description>&lt;P&gt;Syntaxwise seems fine to me, unless your '' is actually 1x double quote instead of 2X single quotes. If you could eleborate more on 'no luck', error messages, logs, expected output given input, etc.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 20:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252813#M6818</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-02-26T20:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252815#M6819</link>
      <description>&lt;P&gt;The '' is actually two single quotes ' ' that I'm trying to use to essentially indicate a null value. &amp;nbsp;So the statement is supposed to be saying, when PIFSTOP equals 0 (ZERO), then ' ' (Blank), ELSE 'C'. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error that it's returning is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&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;=, ?, AND, BETWEEN, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;CONTAINS, EQ, GE, GT, IN, IS, LE, LIKE, LT, NE, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 20:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252815#M6819</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-26T20:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252817#M6820</link>
      <description>&lt;P&gt;Do you need to give it a name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CASE WHEN PIFSTOP &amp;nbsp;= 0 THEN '' ELSE 'C' END AS NEW_VARIABLE&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or is that handled in the DI studio somewhere else?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 21:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252817#M6820</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-26T21:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252822#M6821</link>
      <description>&lt;P&gt;I'm not familiar with DI studio, but the condition &lt;FONT face="courier new,courier"&gt;PIFSTOP=0&lt;/FONT&gt; requires that PIFSTOP is a &lt;EM&gt;numeric&lt;/EM&gt; variable. However, you wrote that&amp;nbsp;it "&lt;SPAN&gt;is a Character Type" (in which case a&amp;nbsp;condition like &lt;FONT face="courier new,courier"&gt;PIFSTOP='0'&lt;/FONT&gt;&amp;nbsp;would be syntactically correct).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That said, your error message is different from what I would anticipate in case of a type mismatch.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 21:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252822#M6821</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-02-26T21:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252839#M6823</link>
      <description>&lt;P&gt;Still no luck but this is the error I receive when trying to view the data after using your CASE Statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unable to execute query: SQL passthru expression contained these errors: ERROR: Expression using equals (=) has components that are of different data types.... &amp;nbsp;ERROR: Character expression requires a character format.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 21:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252839#M6823</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-26T21:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252851#M6824</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75042"&gt;@Daylon_Hunt&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;(...)&amp;nbsp;&lt;STRONG&gt;ERROR: Expression using equals (=) has components that are of different data types. ...&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is the error message indicating that PIFSTOP is of different type (i.e. character vs. numeric) than the constant on the other side of the equals sign (0 or '0').&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 22:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252851#M6824</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-02-26T22:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252852#M6825</link>
      <description>&lt;P&gt;I would agree with that assessment. &amp;nbsp;So now what's the solution? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 22:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252852#M6825</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-26T22:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252864#M6826</link>
      <description>The tricky thing about DI Studio is that you need to check both the Metadata definition  (which should be correct) and the physical data. So check that your input column really is numeric. &lt;BR /&gt;Also, check that you have defined your target column as char.&lt;BR /&gt;You can use Analyze - Contents and the View Data functionality for this.</description>
      <pubDate>Fri, 26 Feb 2016 23:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252864#M6826</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-26T23:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252865#M6827</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: the column name is defined in the transformation Metadata. Thus, it's not specified in the expression. This way, you can quite easily change column definition in a whole program flow via a single point and click operation without having to change expressions.</description>
      <pubDate>Fri, 26 Feb 2016 23:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252865#M6827</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-26T23:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252868#M6828</link>
      <description>&lt;P&gt;I've confirmed that the Source data is indeed Character, and my Target field will also be Character. &amp;nbsp;With that said, I'm now attempting the following CASE statement, which also is not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE WHEN PIFSTOP &amp;nbsp;= 0 THEN 'O' ELSE 'C' END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the exact same Informat and Format types as the Source field, but getting the below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&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;=, ?, AND, BETWEEN, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;CONTAINS, EQ, GE, GT, IN, IS, LE, LIKE, LT, NE, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 23:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252868#M6828</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-26T23:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252879#M6829</link>
      <description>&lt;P&gt;I think the code is then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
CASE WHEN PIFSTOP  = '0' THEN 'O' ELSE 'C' END&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Feb 2016 02:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252879#M6829</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-27T02:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252902#M6837</link>
      <description>If PIFSTOP is char, your constant in the expression must also be defined as char, '0'.</description>
      <pubDate>Sat, 27 Feb 2016 06:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/252902#M6837</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-27T06:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: CASE Statement Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/253050#M6844</link>
      <description>&lt;P&gt;The problem was that I wasn't putting ' ' around the 0, which since zero is a numeric value then I didn't think that it was required but your explanation as to why it has to be, makes perfect sense. &amp;nbsp;Thank you LinusH!!&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2016 18:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/CASE-Statement-Not-Working/m-p/253050#M6844</guid>
      <dc:creator>Daylon_Hunt</dc:creator>
      <dc:date>2016-02-28T18:10:02Z</dc:date>
    </item>
  </channel>
</rss>

