<?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: why? get the chg value -0.2999999999? how to modify it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628742#M185844</link>
    <description>&lt;P&gt;The root cause is how computers store numbers. Details &lt;A href="https://go.documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here some coding options for dealing with it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  aval=51.6;
  base=51.9;
  chg=aval-base;
  chg1=round(aval-base,.0000000001);
  chg2=aval-base;
  chg3=sum(aval,-base);
  format chg2 best32.1;
run;
proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 317px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36495iFF1002AE9D21A731/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2020 11:58:01 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-03-02T11:58:01Z</dc:date>
    <item>
      <title>why? get the chg value -0.2999999999? how to modify it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628722#M185830</link>
      <description>&lt;P&gt;chg=aval- base;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;why? get the value -0.2999999999? how to modify it?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="捕获.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36493i6E6060C21E0BC61B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="捕获.JPG" alt="捕获.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 10:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628722#M185830</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2020-03-02T10:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: why? get the chg value -0.2999999999? how to modify it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628740#M185843</link>
      <description>&lt;P&gt;SAS (and all computer software) stores numbers in a binary form, and so some decimal values cannot be represented exactly, this is not possible and not avoidable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you can change the way the numbers are displayed, so if you assign a format to CHG, then it displays with one decimal place. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format chg 8.1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 11:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628740#M185843</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-02T11:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: why? get the chg value -0.2999999999? how to modify it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628742#M185844</link>
      <description>&lt;P&gt;The root cause is how computers store numbers. Details &lt;A href="https://go.documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here some coding options for dealing with it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  aval=51.6;
  base=51.9;
  chg=aval-base;
  chg1=round(aval-base,.0000000001);
  chg2=aval-base;
  chg3=sum(aval,-base);
  format chg2 best32.1;
run;
proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 317px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36495iFF1002AE9D21A731/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 11:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/628742#M185844</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-02T11:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: why? get the chg value -0.2999999999? how to modify it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/629006#M185945</link>
      <description>Miller, thanks for your answer, there are different parameters with different digitals, it is not good to use format to change all param.</description>
      <pubDate>Tue, 03 Mar 2020 02:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-get-the-chg-value-0-2999999999-how-to-modify-it/m-p/629006#M185945</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2020-03-03T02:50:06Z</dc:date>
    </item>
  </channel>
</rss>

