<?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: Missing in proc sql in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763541#M80952</link>
    <description>&lt;P&gt;You seem to have too many CASE keywords in your code. You only need one CASE to handle this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the MISSING() function to test for missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when missing(pd) then . 
     when pd &amp;lt; 0 then 0 
     when pd&amp;gt;= 1.3220535 then 1.3220535 
     else pd 
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use MIN() and MAX() functions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when not missing(pd) then max(0,min(pd,1.3220535)) else . end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note also that the largest missing value is .Z so you could make sure the value is larger than that.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 14:23:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-08-24T14:23:22Z</dc:date>
    <item>
      <title>Missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763513#M80950</link>
      <description>&lt;P&gt;The code below is returning 0 for all values below 0, including missing values. How to count missing values separately?&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;xxx &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; *&lt;FONT color="#008000"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;case when&amp;nbsp;pd &amp;lt; 0 then 0 else&lt;/P&gt;&lt;P&gt;case when pd&amp;gt;= 1.3220535 then 1.3220535 else pd end end as pd_new*/&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763513#M80950</guid>
      <dc:creator>Thalitacosta</dc:creator>
      <dc:date>2021-08-24T14:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763516#M80951</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391297"&gt;@Thalitacosta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The code below is returning 0 for all values below 0, including missing values. How to count missing values separately?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;create&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;xxx &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; *&lt;FONT color="#008000"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;case when&amp;nbsp;pd &amp;lt; 0 then 0 else&lt;/P&gt;
&lt;P&gt;case when pd&amp;gt;= 1.3220535 then 1.3220535 else pd end end as pd_new*/&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tab&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Rule number 1: Missing is less than any value.&lt;/P&gt;
&lt;P&gt;If you want to detect missing then use the MISSING function&amp;nbsp;&amp;nbsp; when missing(pd) then ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763516#M80951</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-24T14:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763541#M80952</link>
      <description>&lt;P&gt;You seem to have too many CASE keywords in your code. You only need one CASE to handle this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the MISSING() function to test for missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when missing(pd) then . 
     when pd &amp;lt; 0 then 0 
     when pd&amp;gt;= 1.3220535 then 1.3220535 
     else pd 
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use MIN() and MAX() functions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when not missing(pd) then max(0,min(pd,1.3220535)) else . end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note also that the largest missing value is .Z so you could make sure the value is larger than that.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 14:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/763541#M80952</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-24T14:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/766256#M80983</link>
      <description>&lt;P&gt;do case when .z &amp;lt; pd &amp;lt; 0 instead of just &amp;lt; 0&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 19:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Missing-in-proc-sql/m-p/766256#M80983</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-06T19:41:39Z</dc:date>
    </item>
  </channel>
</rss>

