<?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: number in a sas dataset that is not what it appears in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527145#M16324</link>
    <description>If you want it to be 50, try applying the ROUND() function. &lt;BR /&gt;&lt;BR /&gt;ROUND(varName, 0.0001)</description>
    <pubDate>Mon, 14 Jan 2019 21:45:13 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-01-14T21:45:13Z</dc:date>
    <item>
      <title>number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527131#M16322</link>
      <description>&lt;P&gt;I have a number that after removing all formats and informats appears as 50.0000 but behaves like it is less than 50.&amp;nbsp; Any suggestions as to what may be happening here?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527131#M16322</guid>
      <dc:creator>proctice</dc:creator>
      <dc:date>2019-01-14T21:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527139#M16323</link>
      <description>&lt;P&gt;I think this is a numerical precision problem. There are a few ways to deal with it. You could round the variable to the nearest integer and so on.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527139#M16323</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-14T21:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527145#M16324</link>
      <description>If you want it to be 50, try applying the ROUND() function. &lt;BR /&gt;&lt;BR /&gt;ROUND(varName, 0.0001)</description>
      <pubDate>Mon, 14 Jan 2019 21:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527145#M16324</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T21:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527152#M16325</link>
      <description>&lt;P&gt;This can happen when reading a floating point number from another environment (i.e. a database). It's not a SAS problem but a generic challenge when exchanging such numbers between platforms. It's only in the last digits and the way around this is to round the number in the target environment to something of higher precision than what you actually expect the numbers to be. I.e. if you expect to get numbers with up to 4 decimals then use a round() function and round up to the 5th decimal.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  var=50 - (1/10**14);
  var=round(var,.0000000000001);
  if var=50 then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527152#M16325</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-01-14T21:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527158#M16326</link>
      <description>&lt;P&gt;Really annoying.&amp;nbsp; But,&amp;nbsp;I guess some conditional rounding is the only answer.&amp;nbsp; &amp;nbsp;Thanks.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527158#M16326</guid>
      <dc:creator>proctice</dc:creator>
      <dc:date>2019-01-14T22:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: number in a sas dataset that is not what it appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527173#M16327</link>
      <description>&lt;P&gt;Data transfers between different environments (as mentioned by Patrick) are one source of this kind of (numerical accuracy) issues; calculations with non-integer values are another. Here's an example (SAS log under Windows 7)&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;1    data _null_;
2    x=9.9/3.3; /* Obviously, x should be exactly 3. */
3    if x&amp;gt;3 then put 'Surprise!' / x= 32.30; /* Standard formats are deceptive. */
4    d=x-3;
5    put d=; /* The difference is tiny, but not zero. */
6    r=round(x, 1e-9); /* Appropriate rounding "adjusts" the number to what it should be. */
7    put (x r) (hex16. /); /* HEX and BINARY formats tell the truth. */
8    run;

Surprise!
x=3.000000000000000000000000000000
d=4.440892E-16
4008000000000001
4008000000000000&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;/FONT&gt;Note that the standard &lt;EM&gt;w.d&lt;/EM&gt; format (32.30)&amp;nbsp;actually &lt;EM&gt;rounds&lt;/EM&gt; the value so that the deviation from 3 is not shown, although the internal value is (after binary-to-decimal conversion) &lt;FONT face="courier new,courier"&gt;3.000000000000000&lt;STRONG&gt;444089&lt;/STRONG&gt;&lt;/FONT&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's good practice to correct such values as soon as they occur (e.g. after a data transfer) or to avoid them in the first place (if possible), e.g., by using the ROUND function in calculations which otherwise are prone to those issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;Numerical Accuracy in SAS Software&lt;/A&gt;&amp;nbsp;for background information.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 23:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/number-in-a-sas-dataset-that-is-not-what-it-appears/m-p/527173#M16327</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-01-14T23:15:44Z</dc:date>
    </item>
  </channel>
</rss>

