<?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 WHEN with date filter in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955252#M45665</link>
    <description>&lt;P&gt;Ok, I don't see what is wrong with the code you are showing. (Why does everything have to be in the same WHEN statement?)&lt;BR /&gt;&lt;BR /&gt;Is there an error message? If so show us the log for this PROC SQL (all the lines in the log for PROC SQL, not just the lines with the error). Are you getting incorrect output? If so, please provide (a portion of) the input data and show us the incorrect output.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2025 22:09:24 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2025-01-06T22:09:24Z</dc:date>
    <item>
      <title>CASE WHEN with date filter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955250#M45664</link>
      <description>&lt;P&gt;I am trying to do a CASE WHEN with a date filter. I need to add new criteria from 5/6/2024 onward - the new criteria is that we're looking at los &amp;gt;= 20 days instead of rpm_score=.13.&amp;nbsp; I need to keep the rpm_score=.13 but it should only apply to admdt on or before 5/5/2024.&amp;nbsp; How do I update this WHEN statement to reflect the new criteria and keep the old criteria so I can use them all in the same WHEN statement?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        select a.*,b.CMS_ID as HPLAN,
             case
                 when a.RPM_Score &amp;gt;= 0.13 and admdt &amp;lt;="05may2024"d  then 1 
	         when a.los&amp;gt;= 20 and admdt &amp;gt;= "06may2024"d then 1 
		else 0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 21:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955250#M45664</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2025-01-06T21:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN with date filter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955252#M45665</link>
      <description>&lt;P&gt;Ok, I don't see what is wrong with the code you are showing. (Why does everything have to be in the same WHEN statement?)&lt;BR /&gt;&lt;BR /&gt;Is there an error message? If so show us the log for this PROC SQL (all the lines in the log for PROC SQL, not just the lines with the error). Are you getting incorrect output? If so, please provide (a portion of) the input data and show us the incorrect output.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 22:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955252#M45665</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-06T22:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN with date filter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955259#M45667</link>
      <description>&lt;P&gt;I cannot tell from your description what you want.&amp;nbsp; Providing example input data with the expected result would help a lot to clarify (and you will probably answer your own question just be going through the process of making the example data).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect you wnat to NEST the CASE clauses.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when missing(admdt) then .
     when admdt &amp;lt;="05may2024"d then
          case when a.RPM_Score &amp;gt;= 0.13 then 1 else 0 end
     else case when a.RPM_Score &amp;gt;= 0.20 then 1 else 0 end
end&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jan 2025 23:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955259#M45667</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-06T23:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN with date filter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955261#M45668</link>
      <description>yes except for the last case when it would be los &amp;gt;= 20 then 1 else 0.  Thank you!!</description>
      <pubDate>Mon, 06 Jan 2025 23:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955261#M45668</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2025-01-06T23:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: CASE WHEN with date filter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955329#M45669</link>
      <description>If i wanted to include another date filter such as  admtdt &amp;gt;="06may2024"d for when the days_total &amp;gt;=20 (instead of rpm_score &amp;gt;=0.20), where would I put that?</description>
      <pubDate>Tue, 07 Jan 2025 15:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/CASE-WHEN-with-date-filter/m-p/955329#M45669</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2025-01-07T15:36:55Z</dc:date>
    </item>
  </channel>
</rss>

