<?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 means help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302776#M60757</link>
    <description>&lt;P&gt;This is probably related to precision of storing large numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS can accurately store integers up to around 1e15 or 1e16.&amp;nbsp; Decimal fractions can be problematic, even when the numbers are smaller.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, you are saying that 20M records produces the "right" result, but 50M records the "wrong" result.&amp;nbsp; Since you are calculating a sum, this leads me to believe that the sum of 50M values increases the sum to beyond what SAS can accurately store.&amp;nbsp; Internally, it is entirely possible that SAS uses different methods in PROC MEANS vs. a DATA step.&amp;nbsp; The addition process would be the same, but the order in which the numbers are added might be different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, how do you know which one is correct (DATA step vs. PROC MEANS)?&amp;nbsp; Or could they both be incorrect?&amp;nbsp; You can check this by getting the sum of batches:&amp;nbsp; first 20M records, next 20M records, final 10M records, and comparing their total to the 50M sum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2016 19:58:03 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-10-05T19:58:03Z</dc:date>
    <item>
      <title>proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302765#M60754</link>
      <description>&lt;P&gt;I am feeling excited to know, if someone can really understand and crack my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prco means data=ghy1;&lt;/P&gt;&lt;P&gt;var wew;&lt;/P&gt;&lt;P&gt;sum(wew)=wev;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above delivers proper result for sum upto 20 million records, it was a failure for 50 million records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am seeing a slight deviation calculated using data stepI(when decimal was rounded using round fuction)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any option to tell proc means about the sum round for decimals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really happy if someone carcks this...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 19:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302765#M60754</guid>
      <dc:creator>CoolBoy</dc:creator>
      <dc:date>2016-10-05T19:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302770#M60755</link>
      <description>&lt;P&gt;Proc means supports and option MAXDEC to control the maximum number of decimals displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want something like&lt;/P&gt;
&lt;P&gt;Prco means data=ghy1 maxdec=2;&lt;/P&gt;
&lt;P&gt;var wew;&lt;/P&gt;
&lt;P&gt;sum(wew)=wev;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BUT if your data step rounded before accumulating then you introduced a lot of difference, likely some for each record.&lt;/P&gt;
&lt;P&gt;We would have to see your data step code to provide a better reason for differences.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 19:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302770#M60755</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-05T19:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302771#M60756</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108585"&gt;@CoolBoy&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am feeling excited to know, if someone can really understand and crack my question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;We can't understand your question if you don't provide enough details.&lt;/P&gt;
&lt;P&gt;For example, what does 'failure' mean? Did it error out or were the results not what you expected?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you rounding before summing the variables in the data step?&lt;/P&gt;
&lt;P&gt;I don't think there's going to be a way to mimic that in Proc Means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 19:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302771#M60756</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-05T19:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302776#M60757</link>
      <description>&lt;P&gt;This is probably related to precision of storing large numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS can accurately store integers up to around 1e15 or 1e16.&amp;nbsp; Decimal fractions can be problematic, even when the numbers are smaller.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, you are saying that 20M records produces the "right" result, but 50M records the "wrong" result.&amp;nbsp; Since you are calculating a sum, this leads me to believe that the sum of 50M values increases the sum to beyond what SAS can accurately store.&amp;nbsp; Internally, it is entirely possible that SAS uses different methods in PROC MEANS vs. a DATA step.&amp;nbsp; The addition process would be the same, but the order in which the numbers are added might be different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, how do you know which one is correct (DATA step vs. PROC MEANS)?&amp;nbsp; Or could they both be incorrect?&amp;nbsp; You can check this by getting the sum of batches:&amp;nbsp; first 20M records, next 20M records, final 10M records, and comparing their total to the 50M sum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 19:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302776#M60757</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-05T19:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302842#M60761</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Sum by Proc means&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Prco means data=ghy1;&lt;BR /&gt;var wew;&lt;BR /&gt;sum(wew)=wev;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum by data step&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Data GHY1;&lt;BR /&gt;infile xxx;&lt;BR /&gt;input yyyy;&lt;/P&gt;&lt;P&gt;wev = round(wev,.0001) + wew;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maxdec &amp;nbsp;option don't have any affect on sum function(any statsitical analysis), it only effects printing of decimal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 06:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302842#M60761</guid>
      <dc:creator>CoolBoy</dc:creator>
      <dc:date>2016-10-06T06:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc means help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302847#M60762</link>
      <description>&lt;P&gt;You're processing the data before you do the sum. The only way I can think to match this is with a custom format that uses a function to round the data. Or maybe the round in proc format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its not a reasonable expectation to have the results from proc means and the datastep match across 50 million observations in this situation. .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 06:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-means-help/m-p/302847#M60762</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-06T06:18:36Z</dc:date>
    </item>
  </channel>
</rss>

