<?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 I am getting a weird number after doing a sum and not sure how to stop it from happening in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308800#M66321</link>
    <description>&lt;P&gt;I have the following code that I am working with:&lt;/P&gt;
&lt;P&gt;data waiver2(keep=pidm_key tw_amount tbraccd_detail_code tbraccd_term_code);&lt;BR /&gt; retain tw_amount;&lt;BR /&gt; set waiver;&lt;BR /&gt; by pidm_key tbraccd_detail_code tbraccd_term_code;&lt;BR /&gt; if first.tbraccd_term_code then tw_amount=0;&lt;BR /&gt; tw_amount + tbraccd_amt;&lt;BR /&gt; if last.tbraccd_term_code;&lt;BR /&gt; if tw_amount&amp;gt;= 0.01;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data that I have when I go into the tw_amount + tbraccd_amt is:&lt;/P&gt;
&lt;P&gt;tw_amount = 464&lt;BR /&gt;pidm_key = 233793&lt;BR /&gt;tbraccd_amt = -464&lt;BR /&gt;TBRACCD_DETAIL_CODE = WFOS&lt;BR /&gt;TBBDETC_DESC = Waiver CR: MD Foster Care&lt;BR /&gt;TBRACCD_TERM_CODE = 201540&lt;BR /&gt;FIRST.pidm_key = 0&lt;BR /&gt;LAST.pidm_key = 1&lt;BR /&gt;FIRST.TBRACCD_DETAIL_CODE = 0&lt;BR /&gt;LAST.TBRACCD_DETAIL_CODE = 1&lt;BR /&gt;FIRST.TBRACCD_TERM_CODE = 0&lt;BR /&gt;LAST.TBRACCD_TERM_CODE = 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the addition my data looks like this:&lt;/P&gt;
&lt;P&gt;tw_amount = -5.6843418860808E-14&lt;BR /&gt;pidm_key = 233793&lt;BR /&gt;tbraccd_amt = -464&lt;BR /&gt;TBRACCD_DETAIL_CODE = WFOS&lt;BR /&gt;TBBDETC_DESC = Waiver CR: MD Foster Care&lt;BR /&gt;TBRACCD_TERM_CODE = 201540&lt;BR /&gt;FIRST.pidm_key = 0&lt;BR /&gt;LAST.pidm_key = 1&lt;BR /&gt;FIRST.TBRACCD_DETAIL_CODE = 0&lt;BR /&gt;LAST.TBRACCD_DETAIL_CODE = 1&lt;BR /&gt;FIRST.TBRACCD_TERM_CODE = 0&lt;BR /&gt;LAST.TBRACCD_TERM_CODE = 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is going on &amp;amp; how can I avoid this as I want to change the last if statement to not = 0?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2016 17:33:14 GMT</pubDate>
    <dc:creator>HarfordKaren</dc:creator>
    <dc:date>2016-11-02T17:33:14Z</dc:date>
    <item>
      <title>I am getting a weird number after doing a sum and not sure how to stop it from happening</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308800#M66321</link>
      <description>&lt;P&gt;I have the following code that I am working with:&lt;/P&gt;
&lt;P&gt;data waiver2(keep=pidm_key tw_amount tbraccd_detail_code tbraccd_term_code);&lt;BR /&gt; retain tw_amount;&lt;BR /&gt; set waiver;&lt;BR /&gt; by pidm_key tbraccd_detail_code tbraccd_term_code;&lt;BR /&gt; if first.tbraccd_term_code then tw_amount=0;&lt;BR /&gt; tw_amount + tbraccd_amt;&lt;BR /&gt; if last.tbraccd_term_code;&lt;BR /&gt; if tw_amount&amp;gt;= 0.01;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data that I have when I go into the tw_amount + tbraccd_amt is:&lt;/P&gt;
&lt;P&gt;tw_amount = 464&lt;BR /&gt;pidm_key = 233793&lt;BR /&gt;tbraccd_amt = -464&lt;BR /&gt;TBRACCD_DETAIL_CODE = WFOS&lt;BR /&gt;TBBDETC_DESC = Waiver CR: MD Foster Care&lt;BR /&gt;TBRACCD_TERM_CODE = 201540&lt;BR /&gt;FIRST.pidm_key = 0&lt;BR /&gt;LAST.pidm_key = 1&lt;BR /&gt;FIRST.TBRACCD_DETAIL_CODE = 0&lt;BR /&gt;LAST.TBRACCD_DETAIL_CODE = 1&lt;BR /&gt;FIRST.TBRACCD_TERM_CODE = 0&lt;BR /&gt;LAST.TBRACCD_TERM_CODE = 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the addition my data looks like this:&lt;/P&gt;
&lt;P&gt;tw_amount = -5.6843418860808E-14&lt;BR /&gt;pidm_key = 233793&lt;BR /&gt;tbraccd_amt = -464&lt;BR /&gt;TBRACCD_DETAIL_CODE = WFOS&lt;BR /&gt;TBBDETC_DESC = Waiver CR: MD Foster Care&lt;BR /&gt;TBRACCD_TERM_CODE = 201540&lt;BR /&gt;FIRST.pidm_key = 0&lt;BR /&gt;LAST.pidm_key = 1&lt;BR /&gt;FIRST.TBRACCD_DETAIL_CODE = 0&lt;BR /&gt;LAST.TBRACCD_DETAIL_CODE = 1&lt;BR /&gt;FIRST.TBRACCD_TERM_CODE = 0&lt;BR /&gt;LAST.TBRACCD_TERM_CODE = 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is going on &amp;amp; how can I avoid this as I want to change the last if statement to not = 0?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:33:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308800#M66321</guid>
      <dc:creator>HarfordKaren</dc:creator>
      <dc:date>2016-11-02T17:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: I am getting a weird number after doing a sum and not sure how to stop it from happening</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308802#M66322</link>
      <description>&lt;P&gt;You're running into numerical precision issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Round the value before comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if round(tw_amount) = 0 then ...&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308802#M66322</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-02T17:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: I am getting a weird number after doing a sum and not sure how to stop it from happening</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308803#M66323</link>
      <description>The number is a dollar amount so if I round it I will lose the cents. How do I deal with that?&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308803#M66323</guid>
      <dc:creator>HarfordKaren</dc:creator>
      <dc:date>2016-11-02T17:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: I am getting a weird number after doing a sum and not sure how to stop it from happening</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308811#M66327</link>
      <description>&lt;P&gt;Then round to the nearest cent...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;round(variable, 0.01)&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 18:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-am-getting-a-weird-number-after-doing-a-sum-and-not-sure-how/m-p/308811#M66327</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-02T18:02:05Z</dc:date>
    </item>
  </channel>
</rss>

