<?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: How to handle divide/0 in Proc SQL , case statement ? IfError in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751587#M236612</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when b.rate&amp;gt;0 and b.rate &amp;lt;0.25 then (somenum/b.rate)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will not produce an error in SAS, but the resulting variable is still missing in SAS. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when b.rate &amp;lt;0.25 then divide(somenum,b.rate)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which also gives a missing, but no error.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jul 2021 22:25:06 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-07-01T22:25:06Z</dc:date>
    <item>
      <title>How to handle divide/0 in Proc SQL , case statement ? IfError in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751586#M236611</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;PRE&gt;Proc SQL;
select b.this, a.this, 
case
When b.rate &amp;lt;0.25 Then (somenum/b.rate)&lt;/PRE&gt;
&lt;P&gt;b.rate is equal 0, then we have divide by zero. This produces errors in Excel and is handled by IfError.&lt;/P&gt;
&lt;P&gt;What is the equal of IFError is in SAS?&lt;/P&gt;
&lt;P&gt;respectfully,&lt;/P&gt;
&lt;P&gt;Blue blue&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 22:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751586#M236611</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-01T22:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle divide/0 in Proc SQL , case statement ? IfError in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751587#M236612</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when b.rate&amp;gt;0 and b.rate &amp;lt;0.25 then (somenum/b.rate)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will not produce an error in SAS, but the resulting variable is still missing in SAS. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when b.rate &amp;lt;0.25 then divide(somenum,b.rate)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which also gives a missing, but no error.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 22:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751587#M236612</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-01T22:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle divide/0 in Proc SQL , case statement ? IfError in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751588#M236613</link>
      <description>&lt;P&gt;The following will replicate the same behavior as IFERROR.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;Proc SQL;
select b.this, a.this, 
case
When b.rate &amp;lt;0.25 Then coalesce(somenum/b.rate.0)&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;For more information please see:&lt;/P&gt;&lt;P&gt;Function documentation:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/p1gdr5t7sd3g3qn1d7fg23zuwzml.htm#" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/p1gdr5t7sd3g3qn1d7fg23zuwzml.htm#&lt;/A&gt;!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;An example:&lt;BR /&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473712.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473712.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 22:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751588#M236613</guid>
      <dc:creator>KatScott</dc:creator>
      <dc:date>2021-07-01T22:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle divide/0 in Proc SQL , case statement ? IfError in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751589#M236614</link>
      <description>One correction I needed a comma:&lt;BR /&gt;&lt;BR /&gt;Proc SQL;&lt;BR /&gt;select b.this, a.this,&lt;BR /&gt;case&lt;BR /&gt;When b.rate &amp;lt;0.25 Then coalesce(somenum/b.rate,0)&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jul 2021 22:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-handle-divide-0-in-Proc-SQL-case-statement-IfError-in-SAS/m-p/751589#M236614</guid>
      <dc:creator>KatScott</dc:creator>
      <dc:date>2021-07-01T22:28:28Z</dc:date>
    </item>
  </channel>
</rss>

