<?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: Handling 'floating point overflow' error caused by confidence limit when using PROC TTEST in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877278#M43385</link>
    <description>&lt;P&gt;Thanks for the input! Rounding doesn't solve the issue unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the second dummy value in the example code, using anything less than 3.1934 will lead into the floating point overflow error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example, this works just fine, creating the below output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data check;&lt;BR /&gt;AVAL=10.4;&lt;BR /&gt;output;&lt;BR /&gt;AVAL=3.1934; *Works on AVAL=5 or if AVAL&amp;gt;=3.1934;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc ttest data=check dist=lognormal;&lt;BR /&gt;var aval;&lt;BR /&gt;ods output ConfLimits=_COUNT_STAT_GEOMM_00(rename=(GeomMean=GEOMM CV=GCV));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="roskaasia_0-1684936607620.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84242i84EBBEEBB53DAB8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="roskaasia_0-1684936607620.png" alt="roskaasia_0-1684936607620.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably the issue is that the confidence interval for the CV becomes too large when the second dummy value is less than 3.1934. But I still need to calculate the Geometric mean with the original example values, so is there any way to disable the confidence limits from this procedure, as I don't even need them?&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2023 14:05:10 GMT</pubDate>
    <dc:creator>roskaasia</dc:creator>
    <dc:date>2023-05-24T14:05:10Z</dc:date>
    <item>
      <title>Handling 'floating point overflow' error caused by confidence limit when using PROC TTEST</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877217#M43381</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate Geom. mean and Geom. CV and I'm using PROC TTEST for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, often we have cases where the following error occurs:&lt;BR /&gt;ERROR: Computations would cause floating point overflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume that this is caused by the confidence interval calculation leading to too small numbers, but I cannot bypass this even if not calling the CI in the procedure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example code to test the issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data check;&lt;BR /&gt;AVAL=10.4;&lt;BR /&gt;output;&lt;BR /&gt;AVAL=1.3; *Works on AVAL=5;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ttest data=check dist=lognormal ci=NONE cl=NONE;&lt;BR /&gt;var aval;&lt;BR /&gt;ods output ConfLimits=_COUNT_STAT_GEOMM_00(rename=(GeomMean=GEOMM CV=GCV));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 07:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877217#M43381</guid>
      <dc:creator>roskaasia</dc:creator>
      <dc:date>2023-05-24T07:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling 'floating point overflow' error caused by confidence limit when using PROC TTEST</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877246#M43382</link>
      <description>Maybe you need to round this variable before PROC TTEST .&lt;BR /&gt;&lt;BR /&gt;aval=round(aval,0.01);</description>
      <pubDate>Wed, 24 May 2023 11:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877246#M43382</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-05-24T11:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Handling 'floating point overflow' error caused by confidence limit when using PROC TTEST</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877278#M43385</link>
      <description>&lt;P&gt;Thanks for the input! Rounding doesn't solve the issue unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the second dummy value in the example code, using anything less than 3.1934 will lead into the floating point overflow error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example, this works just fine, creating the below output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data check;&lt;BR /&gt;AVAL=10.4;&lt;BR /&gt;output;&lt;BR /&gt;AVAL=3.1934; *Works on AVAL=5 or if AVAL&amp;gt;=3.1934;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc ttest data=check dist=lognormal;&lt;BR /&gt;var aval;&lt;BR /&gt;ods output ConfLimits=_COUNT_STAT_GEOMM_00(rename=(GeomMean=GEOMM CV=GCV));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="roskaasia_0-1684936607620.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84242i84EBBEEBB53DAB8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="roskaasia_0-1684936607620.png" alt="roskaasia_0-1684936607620.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably the issue is that the confidence interval for the CV becomes too large when the second dummy value is less than 3.1934. But I still need to calculate the Geometric mean with the original example values, so is there any way to disable the confidence limits from this procedure, as I don't even need them?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 14:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877278#M43385</guid>
      <dc:creator>roskaasia</dc:creator>
      <dc:date>2023-05-24T14:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Handling 'floating point overflow' error caused by confidence limit when using PROC TTEST</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877292#M43386</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443040"&gt;@roskaasia&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's indeed the upper confidence limit for the geometric coefficient of variation which is causing the issue: According to the formulas in the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_ttest_details07.htm" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;, SAS would try to compute&lt;/P&gt;
&lt;PRE&gt;sqrt(exp(s**2/cinv(0.025,1))-1)&lt;/PRE&gt;
&lt;P&gt;for your sample dataset, where (using your initial test data)&lt;/P&gt;
&lt;PRE&gt;s=log(10.4/1.3)/sqrt(2)&lt;/PRE&gt;
&lt;P&gt;But then &lt;FONT face="courier new,courier"&gt;exp(s**2/cinv(0.025,1))=exp(2201.5136...)=1.274...E956&lt;/FONT&gt;, which exceeds &lt;FONT face="courier new,courier"&gt;constant('big')=1.797...E308&lt;/FONT&gt; by orders of magnitude, hence the overflow error.&lt;/P&gt;
&lt;P&gt;With&amp;nbsp;&lt;SPAN&gt;3.1934 instead of 1.3 the &lt;FONT face="courier new,courier"&gt;exp(&lt;/FONT&gt;...&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt; term is slightly below &lt;FONT face="courier new,courier"&gt;constant('big')&lt;/FONT&gt;: &lt;FONT face="courier new,courier"&gt;1.786...E308&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'd suggest that you compute mean and standard deviation of the log-transformed data and then transform back to the original scale, as described in the documentation linked above:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data logcheck;
set check;
if aval&amp;gt;0 then log_aval=log(aval);
run;

proc summary data=logcheck;
var log_aval;
output out=logstats(drop=_:) n=n mean=m std=s;
run;

data want(drop=m s);
set logstats;
geomm=exp(m);
gcv=sqrt(exp(s**2)-1);
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;You could also compute the other statistics (confidence intervals), if needed.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 15:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Handling-floating-point-overflow-error-caused-by-confidence/m-p/877292#M43386</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-05-24T15:24:54Z</dc:date>
    </item>
  </channel>
</rss>

