<?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: Where Condition on Case When variable values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299404#M63134</link>
    <description>&lt;P&gt;Why is it &lt;U&gt;&lt;STRONG&gt;a.&lt;/STRONG&gt;&lt;/U&gt;Rule_Order when you're calculating it in the step? Is there a variable called Rule_Order in your Table A that differs from the calculated value?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2016 21:28:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-09-19T21:28:16Z</dc:date>
    <item>
      <title>Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299328#M63086</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble with my Where condition:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  and a.Rule_Order is not null;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whenever I add this condition to my query no rows are returned. I've verified that there are Rule_Order values of 1.0, 1.5, and . in the SAS dataset when I exclude this condition. So this leaves me to believe it has something to do with my Case When statement processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone see what it is I'm doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table QueryData00926 as
select DISTINCT
     a.actual_dlvry_date as ad_dt,
     a.imb_code length = 31,
     a.imb_dlvry_zip_5,
     CASE
           WHEN (A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL ) THEN 1.0
           WHEN (A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE ) THEN 1.5
     ELSE .
     END as Rule_Order length = 5 format=4.1
from QueryDataBase00926 as a
inner join QueryDataBase&amp;amp;ZIP5 as b
on a.imb_code=b.imb_code
where a.source='A' and b.source='B' &lt;BR /&gt;  and a.Rule_Order is not null;
quit;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 16:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299328#M63086</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-09-19T16:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299330#M63088</link>
      <description>&lt;P&gt;Is this a pass through to another database?&lt;/P&gt;
&lt;P&gt;If not you may mean&lt;/P&gt;
&lt;P&gt;missing (A&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE) AND not missing(B&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS doesn't use NULL.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 16:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299330#M63088</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-19T16:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299370#M63111</link>
      <description>&lt;P&gt;Hmm, I tried this too, but got the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think since Rule_Order exists as missing (.) on both tables for all records, that during the merge the Where condition is only seeing those missing values and not the recoded Rule_Order values from the Case When condtions...does that make sense? &amp;nbsp;It's like the&amp;nbsp;&lt;SPAN&gt;newly created Rule_Order column from the Case When condtions can't be seen by the Where condition or something???&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 19:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299370#M63111</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-09-19T19:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299388#M63124</link>
      <description>&lt;P&gt;Also need to modify this statement to get rid of the the Null:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;Rule_Order is &lt;SPAN class="token operator"&gt;not&lt;/SPAN&gt; null&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few rows of data may help. &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; has instruction on created text of a data step you could post here to provide example data to run code against. You would only need to provide enough rows to exercise the the code involved and only the variables mentioned.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 19:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299388#M63124</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-19T19:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299399#M63133</link>
      <description>Yah, I tried it as 'and a.rule_order is not missing', but got the same thing.&lt;BR /&gt;&lt;BR /&gt;Yes, I'll try to reproduce with some simple data.</description>
      <pubDate>Mon, 19 Sep 2016 20:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299399#M63133</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-09-19T20:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Where Condition on Case When variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299404#M63134</link>
      <description>&lt;P&gt;Why is it &lt;U&gt;&lt;STRONG&gt;a.&lt;/STRONG&gt;&lt;/U&gt;Rule_Order when you're calculating it in the step? Is there a variable called Rule_Order in your Table A that differs from the calculated value?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 21:28:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-Condition-on-Case-When-variable-values/m-p/299404#M63134</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-19T21:28:16Z</dc:date>
    </item>
  </channel>
</rss>

