<?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: proc sort - SUM function on group by returns different results depending on sort order in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202025#M50438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This goes back to &lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s statement about it being a numeric binary problem--sum is a sequential operation, and when you exceed the numerical precision, you start accumulating rounding "errors".&amp;nbsp; It seems logical, at least to me, that the sort order is going to affect this dramatically.&amp;nbsp; The difference comes into the sum at different points in the sequence, and propagates.&amp;nbsp; i see this happen a fair amount in iterative statistical procedures (maximum likelihood estimation, especially), so when duplicating analyses on separate machines, it is critical to have the sort order prior to analysis identical on the two machines.&amp;nbsp; At least that way, the propagated errors should be identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you shift everything to integer arithmetic, and not overflow?&amp;nbsp; That seems to be the most straightforward way.&amp;nbsp; The other is to compare using a fuzzy logic that accounts for accumulated error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2015 12:04:55 GMT</pubDate>
    <dc:creator>SteveDenham</dc:creator>
    <dc:date>2015-06-10T12:04:55Z</dc:date>
    <item>
      <title>proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202017#M50430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am hoping somebody can explain why - and how to work around - the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This comes from sales data - essentially a few sales and then all of the items were returned for a refund - which is why I have positive and the same negative values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expected net result of all of the transactions is zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the code as is and then remove the comments on the SORT procedure and the &lt;STRONG&gt;proc sql group by&lt;/STRONG&gt; will produce 2 different results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;either:&lt;/P&gt;&lt;P&gt;num=.0000000000000568434188608080000&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;num=.0000000000000000000000000000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if num &amp;gt;0 then a sale is counted if num=0 then no sale&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So depending on the sort order of the input data set I can either have a sale counted or not - this is obviously inaccurate!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can round and format to get a value closer to zero - that's not the question - at the office there are many examples of this type of coding and not enough time to go and recode all of the analytic code around the enterprise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Preferably somebody has come across this and there is a SAS Option I can use or a hotfix that can be installed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;currently tested on:&lt;/P&gt;&lt;P&gt;aix 6.1 with SAS 9.2&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;aix 7.1 with SAS 9.4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.Input_Data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; category ='a';&lt;/P&gt;&lt;P&gt;&amp;nbsp; length num 8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input num;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;299&lt;/P&gt;&lt;P&gt;-299&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;299&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;-299&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;-218.31&lt;/P&gt;&lt;P&gt;218.31&lt;/P&gt;&lt;P&gt;218.31&lt;/P&gt;&lt;P&gt;-218.31&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* UNCOMMENT THIS SORT BELOW TO SEE CORRECT RESULTS IN WORK.OUTPUT1 *;&lt;/P&gt;&lt;P&gt;/*proc sort data=work.Input_Data; by num; quit;*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * this (group by) sometimes produces incorrect results *;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table WORK.output1 as select category, sum(num) as num from work.Input_Data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; group by category;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * this works *;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table WORK.output2 as select sum(num) as num from work.Input_Data;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* this works *;&lt;/P&gt;&lt;P&gt;proc summary data=work.Input_Data nway n;&lt;/P&gt;&lt;P&gt;class category;&lt;/P&gt;&lt;P&gt;var num;&lt;/P&gt;&lt;P&gt;output out=WORK.output3 sum=;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set WORK.output1;&amp;nbsp; &lt;/P&gt;&lt;P&gt;* num should be equal to zero - strangely depends on the the order of rows in the work.Input_Data above *;&lt;/P&gt;&lt;P&gt;format num&amp;nbsp; tst 32.31;&lt;/P&gt;&lt;P&gt;tst=round(num,0.001);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put num=;&lt;/P&gt;&lt;P&gt;if num &amp;gt;0 then put "Greater";&lt;/P&gt;&lt;P&gt;if num =0 then put "Equal";&lt;/P&gt;&lt;P&gt;if num &amp;lt;0 then put "Less";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put tst=;&lt;/P&gt;&lt;P&gt;if tst &amp;gt;0 then put "Greater";&lt;/P&gt;&lt;P&gt;if tst =0 then put "Equal";&lt;/P&gt;&lt;P&gt;if tst &amp;lt;0 then put "Less";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set WORK.output2;&amp;nbsp; &lt;/P&gt;&lt;P&gt;* num equal to zero *;&lt;/P&gt;&lt;P&gt;format num 32.31;&lt;/P&gt;&lt;P&gt;put num=;&lt;/P&gt;&lt;P&gt;if num &amp;gt;0 then put "Greater";&lt;/P&gt;&lt;P&gt;if num =0 then put "Equal";&lt;/P&gt;&lt;P&gt;if num &amp;lt;0 then put "Less";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_; set WORK.output3; &lt;/P&gt;&lt;P&gt;* num equal to zero *;&lt;/P&gt;&lt;P&gt;format num 32.31;&lt;/P&gt;&lt;P&gt;put num=;&lt;/P&gt;&lt;P&gt;if num &amp;gt;0 then put "Greater";&lt;/P&gt;&lt;P&gt;if num =0 then put "Equal";&lt;/P&gt;&lt;P&gt;if num &amp;lt;0 then put "Less";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 05:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202017#M50430</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T05:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202018#M50431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you read all those things about numeric orecision?&lt;/P&gt;&lt;P&gt;As soon as you are going into not whole numbers or having more than 12 digits you are in the area that 1 might not be equal to 1 due to that precision. Remember the slider.&lt;/P&gt;&lt;P&gt;It is not a SAS problem it is numeric binary global one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 06:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202018#M50431</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-06-10T06:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202019#M50432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jaap - I am aware of what you are discussing but that is not the question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not about precision or scale.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question:&lt;/P&gt;&lt;P&gt;Why does the &lt;STRONG&gt;sort order of the records&lt;/STRONG&gt; in the input data set return different total values when summed in the proc sql - when using the SAME individual record &amp;amp; values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which indicates a SAS proc sql bug.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 06:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202019#M50432</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T06:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202020#M50433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also - look at the example code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CORRECT result is returned with a PROC SUMMARY (implies the data gets sorted) where as the PROC SQL .. SUM ... GROUP BY returns a different result to the proc summary on the SAME records when not sorted - but the correct result when the input data set is sorted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 06:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202020#M50433</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T06:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202021#M50434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;#327 on my constantly growing list of reasons why to avoid PROC SQL.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 07:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202021#M50434</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-10T07:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202022#M50435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately - SAS DI studio produces a lot of proc sql code - so how reliable are the results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;must I go to 20 plus analysts and senior management to explain that SAS proc sql is not 100% accurate - that the scoring models used for profitability are most likely producing inaccurate results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I.E:&lt;/P&gt;&lt;P&gt;Depending on the record SORT ORDER - a customer might be scored as profitable?&lt;/P&gt;&lt;P&gt;However the same customer with the same records (sales behavior) - but using a different SORT ORDER will NOT be scored profitable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 08:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202022#M50435</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T08:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202023#M50436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the inaccuracies are very small.&lt;/P&gt;&lt;P&gt;Note that when working with data in "real" storage format, it is prudent to round before doing a = comparison, as you may always have artifacts from previous computations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 08:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202023#M50436</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-10T08:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202024#M50437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well - for statistics - any inaccuracies is unacceptable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0 (zero) is either 0 (zero) or it is greater than or less than 0 (zero)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My challenge is that there are perhaps a hundred different SAS programs dealing with more than 5 SAS data sets each and each SAS data set has many hundreds of variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So going back to recode (round) each of those variables in all of that code is a huge undertaking - and impracticable right now.&lt;/P&gt;&lt;P&gt;I am in the process of migrating from SAS 9.2 to a new SAS 9.4 environment and have to compare the 2 environments - so this might need to be done in both environments to get equal results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which goes back to the original question(s)&lt;/P&gt;&lt;P&gt;- is there a SAS option that can be used to force a SAS data set to be sorted before a proc sql (since this seems to solve the issue but I don't know of such an option)&lt;/P&gt;&lt;P&gt;- is there a SAS option that globally will "round" numeric variables - i.e. evaluate using the first 3 decimals only?&lt;/P&gt;&lt;P&gt;- why does proc summary produce the expected "correct" result but the proc sql does not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am just trying to ensure that there is no quick fix solution before going back to the client and informing them that their current code is inaccurate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 08:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202024#M50437</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T08:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202025#M50438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This goes back to &lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s statement about it being a numeric binary problem--sum is a sequential operation, and when you exceed the numerical precision, you start accumulating rounding "errors".&amp;nbsp; It seems logical, at least to me, that the sort order is going to affect this dramatically.&amp;nbsp; The difference comes into the sum at different points in the sequence, and propagates.&amp;nbsp; i see this happen a fair amount in iterative statistical procedures (maximum likelihood estimation, especially), so when duplicating analyses on separate machines, it is critical to have the sort order prior to analysis identical on the two machines.&amp;nbsp; At least that way, the propagated errors should be identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you shift everything to integer arithmetic, and not overflow?&amp;nbsp; That seems to be the most straightforward way.&amp;nbsp; The other is to compare using a fuzzy logic that accounts for accumulated error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202025#M50438</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2015-06-10T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202026#M50439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know the precision of dollars is 2 decimal place so why not just round.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; WORK.output1 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; category, &lt;STRONG&gt;round(sum(num),&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;.01&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; num &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; work.Input_Data&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202026#M50439</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-06-10T12:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202027#M50440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Steven -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you look at the test data - a SAS numeric variable of length 8 should be able to store these test values - without accumulating rounding "errors"&lt;/P&gt;&lt;P&gt;299&lt;/P&gt;&lt;P&gt;-299&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;299&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;-299&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;283.8&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;-283.8&lt;/P&gt;&lt;P&gt;-218.31&lt;/P&gt;&lt;P&gt;218.31&lt;/P&gt;&lt;P&gt;218.31&lt;/P&gt;&lt;P&gt;-218.31&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also doesn't seem to explain why in this test case the GROUP BY function - in this test case only 1 group - produces different totals with the same records.&lt;/P&gt;&lt;P&gt;I would expect the same "accumulating rounding errors" to occur since the single group total is the same as the 'grand' total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With testing (changing the order of records) I can produce different 'errors' (value differences) - so I agree it has something to do with the numeric binary problem - I don't see why it should be occurring in this test case though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS length 8 numeric variable should be able to store these values - without rounding concerns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for all the replies&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202027#M50440</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T12:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202028#M50441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for the reply - I know about the syntax to round and it is the response that I will suggest to the team.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately there are 1000's of lines of production code by other developers/analytical teams that will have to be manually checked and corrected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was looking for an global option that would alleviate the need to manually check those 1000's of lines of production code over hundreds of numeric variables since any change to the production code will have to go through a review process to confirm results and it could be weeks before the manually corrected code is again implemented into production.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Quinton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202028#M50441</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T12:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202029#M50442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;None of those values will translate exactly in hexadecimal form.&amp;nbsp; The 8 byte format has nothing to do with the physical length of the string--that only applies to character variables (as I found out the other day when I tried to format a numeric variable as 2.1).&amp;nbsp; So order and representation of decimals as hexadecimals are having an effect.&amp;nbsp; Data_null's solution seems the easiest to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202029#M50442</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2015-06-10T12:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202030#M50443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steven&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;taken from - &lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#a000344718.htm" title="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#a000344718.htm"&gt;SAS(R) 9.2 Companion for UNIX Environments&lt;/A&gt;&lt;/P&gt;&lt;P&gt;====&lt;/P&gt;&lt;P&gt;Numeric Variable Length and Precision in UNIX Environments&lt;/P&gt;&lt;P&gt;The default length of numeric variables in SAS data sets is 8 bytes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue of numeric precision affects the return values of almost all SAS math functions and many numeric values returned from SAS procedures. Numeric values in SAS for UNIX are represented as IEEE double-precision floating-point numbers. &lt;STRONG&gt;The decimal precision of a full 8-byte number is effectively 15 decimal digits.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=====&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So - once again - All of those test&amp;nbsp; numbers should easily fit into a length 8 numeric SAS variable that has precision to 15 decimal digits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to clarify - I am using a length 8 numeric variable - the HIGHEST precision that SAS offers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not formatting the numeric variable and getting 'error's or mismatches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202030#M50443</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T12:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202031#M50444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is not the VARIABLES, it is the OPERATIONS that are most affected in this case.I guess you could even work with 256 bit variables, as soon as you have fractions that do not easily translate into binary, you will end up with non-zero digits at the end of the mantissa, which will cause problems after mathematical operations. Sometimes those cancel each other out, thanks to the sequence, sometimes not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202031#M50444</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-10T13:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202032#M50445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kurt - thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am starting to understand this a bit more:&lt;/P&gt;&lt;P&gt;==&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;The IEEE 754 standard is a method of storing floating-point numbers in a compact way that is easy to manipulate. This standard is used by Intel coprocessors and most PC-based programs that implement floating-point math.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;IEEE 754 specifies that numbers be stored in binary format to reduce storage requirements and allow the built-in binary arithmetic instructions that are available on all microprocessors to process the data in a relatively rapid fashion. However, some numbers that are simple, nonrepeating decimal numbers are converted into repeating binary numbers that cannot be stored with perfect accuracy.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;For example, the number 1/10 can be represented in a decimal number system with a simple decimal:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="indent" style="padding: 0 20px 10px; color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;.1&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;However, the same number in binary format becomes the repeating binary decimal:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="indent" style="padding: 0 20px 10px; color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;.0001100011000111000111 (and so on)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;This number cannot be represented in a finite amount of space. Therefore, this number is rounded down by approximately -2.78E-17 when it is stored.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Segoe UI regular', 'Segoe UI', Arial, Tahoma, sans-serif; font-size: 13px; background-color: #ffffff;"&gt;If several arithmetic operations are performed to obtain a given result, these rounding errors may be cumulative.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 14:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202032#M50445</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-10T14:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202033#M50446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Steve, the numbers are getting into a binary way not decimal digits. You are getting the same isuues as the accuracy of 1/3 and than adding it.&lt;/P&gt;&lt;P&gt;The real maths will get some fractions to miss the real value as a result 0《》0 . There are many notes on that fuzz factor and more. The first calculators where als showing that. As people got confused they made an automatic rounding to the result.&lt;/P&gt;&lt;P&gt;Now people get confused on binary arithmetic. As the rounding got standardized that rounding could become introduced in SAS. I have seen some notes about that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 16:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202033#M50446</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-06-10T16:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202034#M50447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THIS is exactly what happens. The only way out of this is by adding additional numeric storage formats. Like packed decimal or integer, where the programmer has to provide logic for fractions.&lt;/P&gt;&lt;P&gt;SAS obviously does not want to do that, for reasons of keeping everything simple.&lt;/P&gt;&lt;P&gt;Everytime you have the need to make comparisons with exact discrete values, have to deal with fractions, and need to do computations first, it is very wise to use the round() function on the results of the computations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 05:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202034#M50447</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-11T05:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202035#M50448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The floating numbers are also named real numbers in mathematics because that is what is in the real world with measurements is happening. As the goal is statistics and modeling (predictive and uncertaintity) that makes perfectly sense to use. Super computers are many times evaluated by Tflops not mips. That automatic rounding as standard will help to hide some things ieee 754 Wikipedia is a good start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only do in additions and subtraction you could use paced zoned with the ds2 language. Only with external dbms systems that will also stored that as it is not continued in Sas datasets. That is a difference of the goal of world's analytics real type numbers. Not limited by whole numbers or decimal representation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 05:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202035#M50448</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-06-11T05:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort - SUM function on group by returns different results depending on sort order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202036#M50449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to everybody that contributed - I learned something new which I will not forget soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt;USING FLOATING-POINT (I.E., REAL BINARY) REPRESENTATION&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;THERE HAPPENS TO BE NO EXACT BINARY REPRESENTATION FOR THE DECIMAL VALUES OF 0.1 AND 0.3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;3 EXAMPLES BELOW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;references:&lt;/P&gt;&lt;P&gt;&lt;A href="http://analytics.ncsu.edu/sesug/2008/PO-082.pdf" title="http://analytics.ncsu.edu/sesug/2008/PO-082.pdf"&gt;http://analytics.ncsu.edu/sesug/2008/PO-082.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p0ji1unv6thm0dn1gp4t01a1u0g6.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/67885/HTML/default/viewer.htm#p0ji1unv6thm0dn1gp4t01a1u0g6.htm"&gt;SAS(R) 9.4 Language Reference: Concepts, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/31/560.html" title="http://support.sas.com/kb/31/560.html"&gt;31560 - Choosing your degree of numeric precision&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;==================================================================&lt;/P&gt;&lt;P&gt;** EXAMPLE USING 0.1 - THIS IS NOT ACCURATE **;&lt;/P&gt;&lt;P&gt; data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x=10.1; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "ORIGINAL VALUE:";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put x= 32.30;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put x= hex16.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; y=10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; newx=(x+y)-y; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put / "ORIGINAL VALUE AFTER ADDING AND SUBTRACTING 10:";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put newx= 32.30;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put newx= hex16.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put / "DIFFERENCE AFTER ADDING AND SUBTRACTING 10:";&lt;/P&gt;&lt;P&gt;&amp;nbsp; diff=x-newx;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put diff= 32.30;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put diff= hex16.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOG OUTPUT:&lt;/P&gt;&lt;P&gt;ORIGINAL VALUE:&lt;/P&gt;&lt;P&gt;x=10.10000000000000000000000000000&lt;/P&gt;&lt;P&gt;x=4024333333333333&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORIGINAL VALUE AFTER ADDING AND SUBTRACTING 10:&lt;/P&gt;&lt;P&gt;newx=10.10000000000000000000000000000&lt;/P&gt;&lt;P&gt;newx=402433333333333&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIFFERENCE AFTER ADDING AND SUBTRACTING 10:&lt;/P&gt;&lt;P&gt;diff=-.000000000000001776356839400250&lt;/P&gt;&lt;P&gt;diff=BCE0000000000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;==================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** EXAMPLE USING 0.3 - THIS IS NOT ACCURATE **;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;format ExactVar BinaryVar hex16.;&lt;/P&gt;&lt;P&gt;* LOGICALLY THESE ARE THE SAME VALUE *;&lt;/P&gt;&lt;P&gt;ExactVar=0.3;&lt;/P&gt;&lt;P&gt;BinaryVar=3*0.1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Diff=ExactVar-BinaryVar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* BUT THEY ARE STORED DIFFERENTLY IN HEX/BINARY *;&lt;/P&gt;&lt;P&gt;put ExactVar=&amp;nbsp; BinaryVar= Diff= 32.30;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOG OUTPUT:&lt;/P&gt;&lt;P&gt;ExactVar=3FD3333333333333 BinaryVar=3FD3333333333334 Diff=-.000000000000000055511151231258&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;==================================================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** EXAMPLE USING 0.2 - THIS IS ACCURATE **;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;format ExactVar BinaryVar hex16.;&lt;/P&gt;&lt;P&gt;* LOGICALLY THESE ARE THE SAME VALUE *;&lt;/P&gt;&lt;P&gt;ExactVar=0.2;&lt;/P&gt;&lt;P&gt;BinaryVar=2*0.1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Diff=ExactVar-BinaryVar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* BUT THEY ARE STORED DIFFERENTLY IN HEX/BINARY *;&lt;/P&gt;&lt;P&gt;put ExactVar=&amp;nbsp; BinaryVar= Diff= 32.30;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOG OUTPUT:&lt;/P&gt;&lt;P&gt;ExactVar=3FC999999999999A BinaryVar=3FC999999999999A Diff=0.000000000000000000000000000000&lt;/P&gt;&lt;P&gt;==================================================================&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 07:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sort-SUM-function-on-group-by-returns-different-results/m-p/202036#M50449</guid>
      <dc:creator>quintonsmit_gmail_com</dc:creator>
      <dc:date>2015-06-11T07:09:05Z</dc:date>
    </item>
  </channel>
</rss>

