<?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: Recoding a variable - Not sure I'm using Case correctly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292018#M60538</link>
    <description>&lt;P&gt;Remove the a.ruleflag after the word Case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 22:12:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-08-16T22:12:52Z</dc:date>
    <item>
      <title>Recoding a variable - Not sure I'm using Case correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292015#M60537</link>
      <description>&lt;P&gt;I'm trying to recode RuleFlag to the value of '1' (&amp;amp;Rule_Order_Char) when the following conditions are met: &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL or A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE AND a.RULEFLAG = "-"&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'm getting the error: &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;ERROR: Operand of WHEN clause 1 is not the same data type as the CASE operand.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I using Case the wrong way? Is there another way to achieve the desired recoding during a Select statement? ny help would be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2224          proc sql;
2225          create table QueryData&amp;amp;ZIP5._&amp;amp;RULE_ORDER_CHAR as
SYMBOLGEN:  Macro variable ZIP5 resolves to 00926
SYMBOLGEN:  Macro variable RULE_ORDER_CHAR resolves to 1
2226          select DISTINCT %unquote(%str(%')&amp;amp;ANALYSIS_DESC.%str(%')) as rule_nm length = 58,
SYMBOLGEN:  Macro variable ANALYSIS_DESC resolves to TEST
2227                      a.actual_dlvry_date as ad_dt,
2228                      a.imb_code length = 31,
2229                      &amp;amp;RULE_ORDER as rule_order,
SYMBOLGEN:  Macro variable RULE_ORDER resolves to 1
2230                      a.imb_dlvry_zip_5,
2231                      CASE a.RULEFLAG
2232                          WHEN A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL or
            A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE
 AND a.RULEFLAG = "-" THEN "&amp;amp;RULE_ORDER_CHAR"
SYMBOLGEN:  Macro variable RULE_ORDER_CHAR resolves to 1
2233                      END as rule_flag
2234          from QueryData&amp;amp;ZIP5 as a
SYMBOLGEN:  Macro variable ZIP5 resolves to 00926
2235          inner join QueryData&amp;amp;ZIP5 as b
SYMBOLGEN:  Macro variable ZIP5 resolves to 00926
2236          on a.imb_code=b.imb_code
2237          where a.source="A" and b.source="B";
ERROR: Operand of WHEN clause 1 is not the same data type as the CASE operand.
NOTE: A CASE expression has no ELSE clause. Cases not accounted for by the WHEN clauses will result in a missing value for the
      CASE expression.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
2238          quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 21:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292015#M60537</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-16T21:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding a variable - Not sure I'm using Case correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292018#M60538</link>
      <description>&lt;P&gt;Remove the a.ruleflag after the word Case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 22:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292018#M60538</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-16T22:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding a variable - Not sure I'm using Case correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292025#M60541</link>
      <description>Worked. Thanks for your time!</description>
      <pubDate>Tue, 16 Aug 2016 23:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-a-variable-Not-sure-I-m-using-Case-correctly/m-p/292025#M60541</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-16T23:27:11Z</dc:date>
    </item>
  </channel>
</rss>

