<?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: Division by zero in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611601#M18226</link>
    <description>&lt;P&gt;So you want to change the zeros in B to ones?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b=0 then b=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you do first that then your code will run without any divide by zeros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (a&amp;lt;1000)
  or (((a/b)&amp;lt;0.1) and (c&amp;lt; 5000000) and d in (., 0))
  or (((a/b)&amp;lt;0.1) and (c&amp;lt;10000000) and d in (., 0))
  or ((a&amp;lt; 500000) and (c&amp;lt; 5000000) and d in (., 0))
  or ((a&amp;lt;1000000) and (c&amp;lt;10000000) and d in (., 0))
  then e=1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you only want to do it only when B is &amp;gt; 0 then add that to the code.&amp;nbsp; Note that if you test after you have change the zeros to ones then B will now be &amp;gt; 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2019 15:29:47 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-12-13T15:29:47Z</dc:date>
    <item>
      <title>Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611439#M18195</link>
      <description>&lt;P&gt;how can I fix if there are zeros in b? I want to change b=1 when b=0 and run this code when b&amp;gt;0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&amp;nbsp;&lt;BR /&gt;if (a &amp;lt; 1000 OR&lt;/P&gt;&lt;P&gt;(a/b &amp;lt;.1 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;&lt;P&gt;(a/b &amp;lt; .1 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;&lt;P&gt;(a &amp;lt; 500000 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;&lt;P&gt;(a &amp;lt; 1000000 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.))) then e = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Division by zero detected at line 1393 column 29.&lt;BR /&gt;NOTE: Division by zero detected at line 1394 column 29.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 20:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611439#M18195</guid>
      <dc:creator>sasuser1031</dc:creator>
      <dc:date>2019-12-12T20:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611441#M18197</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75014"&gt;@sasuser1031&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;how can I fix if there are zeros in b? I want to change b=1 when b=0 and run this code when b&amp;gt;0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&amp;nbsp;&lt;BR /&gt;if (a &amp;lt; 1000 OR&lt;/P&gt;
&lt;P&gt;(a/b &amp;lt;.1 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;(a/b &amp;lt; .1 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;(a &amp;lt; 500000 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;(a &amp;lt; 1000000 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.))) then e = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Division by zero detected at line 1393 column 29.&lt;BR /&gt;NOTE: Division by zero detected at line 1394 column 29.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Before this IF statement, use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;b=b*(b&amp;gt;0) + (b=0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if b&amp;gt;0, we use the value of b. If b=0 we use the value 1.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 20:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611441#M18197</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-12T20:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611443#M18198</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75014"&gt;@sasuser1031&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've changed b=0 to b=1, do you want to run the code for this new value of b, or do you want to run this code only when b is initially different from 0?&lt;/P&gt;
&lt;P&gt;If it is the first cas, you can try the below code.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	if b=0 then b=1;
	if b&amp;gt;0 then do;
		if (a &amp;lt; 1000) OR
	  	 (a/b &amp;lt;.1 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR
	  	 (a/b &amp;lt; .1 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.)) OR
	  	 (a &amp;lt; 500000 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR
	  	 (a &amp;lt; 1000000 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.)) then e = 1;
	   end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 20:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611443#M18198</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-12T20:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611539#M18215</link>
      <description>&lt;P&gt;Using function DIVIDE() instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if (a &amp;lt; 1000 OR&lt;/P&gt;
&lt;P&gt;( divide(a,b) &amp;lt;.1 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;( divide(a,b) &amp;lt; .1 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;(a &amp;lt; 500000 &amp;amp; c &amp;lt; 5000000 &amp;amp; d IN (0,.)) OR&lt;/P&gt;
&lt;P&gt;(a &amp;lt; 1000000 &amp;amp; c &amp;lt; 10000000 &amp;amp; d IN (0,.))) then e = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 10:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611539#M18215</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-13T10:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611586#M18223</link>
      <description>&lt;P&gt;I want to run the&amp;nbsp; code for both.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 14:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611586#M18223</guid>
      <dc:creator>sasuser1031</dc:creator>
      <dc:date>2019-12-13T14:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Division by zero</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611601#M18226</link>
      <description>&lt;P&gt;So you want to change the zeros in B to ones?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b=0 then b=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you do first that then your code will run without any divide by zeros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (a&amp;lt;1000)
  or (((a/b)&amp;lt;0.1) and (c&amp;lt; 5000000) and d in (., 0))
  or (((a/b)&amp;lt;0.1) and (c&amp;lt;10000000) and d in (., 0))
  or ((a&amp;lt; 500000) and (c&amp;lt; 5000000) and d in (., 0))
  or ((a&amp;lt;1000000) and (c&amp;lt;10000000) and d in (., 0))
  then e=1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you only want to do it only when B is &amp;gt; 0 then add that to the code.&amp;nbsp; Note that if you test after you have change the zeros to ones then B will now be &amp;gt; 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 15:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Division-by-zero/m-p/611601#M18226</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-13T15:29:47Z</dc:date>
    </item>
  </channel>
</rss>

