<?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: Add 1, subtract 1 in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147800#M2472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom, that's interesting. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know how I might be able to rewrite the code to make it work regardless of the order or operations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Mar 2014 09:13:57 GMT</pubDate>
    <dc:creator>Lupacante</dc:creator>
    <dc:date>2014-03-19T09:13:57Z</dc:date>
    <item>
      <title>Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147796#M2468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why is it that these two codes work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;data strange;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable = 1/5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if variable = 0.2;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;data strange2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable = 1 - 1 +1/5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if variable = 0.2;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;but this one doesn't:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;data strange3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable = 1/5 + 1 - 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if variable = 0.2;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;thank you,&lt;BR /&gt;Marco&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 17:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147796#M2468</guid>
      <dc:creator>Lupacante</dc:creator>
      <dc:date>2014-03-18T17:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147797#M2469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know why order of operations matters here but it does.&amp;nbsp; It's a floating point thing.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; variable1 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; variable2 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; - &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; variable3 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; + &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; - &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (variable:) (=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;hex16.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; / );&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;variable1=3FC999999999999A&lt;BR /&gt;variable2=3FC999999999999A&lt;BR /&gt;variable3=3FC9999999999998&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 17:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147797#M2469</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-03-18T17:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147798#M2470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note behavior for this as well which does yield expected results.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;data strange4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable = 1/5 + (1 - 1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if variable = 0.2;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 17:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147798#M2470</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-03-18T17:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147799#M2471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1/5 cannot be exactly represented as a binary number.&amp;nbsp; The order of operations matter because by adding 1 to 1/5 you have moved where the first 1 is in the binary representation, thus leaving fewer bits to represent the value of 1/5. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 18:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147799#M2471</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-03-18T18:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147800#M2472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom, that's interesting. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know how I might be able to rewrite the code to make it work regardless of the order or operations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 09:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147800#M2472</guid>
      <dc:creator>Lupacante</dc:creator>
      <dc:date>2014-03-19T09:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147801#M2473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just round it.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; v1 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; v2 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; - &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; v3 = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;/&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; + &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; - &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; r1 = round(v1,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1e-6&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; r2 = round(v2,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1e-6&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; r3 = round(v3,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1e-6&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (v: r:) (=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;hex16.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; / );&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;v1=3FC999999999999A&lt;BR /&gt;v2=3FC999999999999A&lt;BR /&gt;v3=3FC9999999999998&lt;BR /&gt;r1=3FC999999999999A&lt;BR /&gt;r2=3FC999999999999A&lt;BR /&gt;r3=3FC999999999999A&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 13:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147801#M2473</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-03-19T13:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add 1, subtract 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147802#M2474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Approach this with caution. These comparisons are inherently wobbly in computing systems, and what works for one example may fail in another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why are you trying to make this equality comparison? There may be a way to do it that will avoid this difficulty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 14:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Add-1-subtract-1/m-p/147802#M2474</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-03-19T14:12:19Z</dc:date>
    </item>
  </channel>
</rss>

