<?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 BESTDw.p format in proc iml in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520373#M141089</link>
    <description>&lt;P&gt;Hi, I want to format&amp;nbsp;p&amp;nbsp;in the macro below so that I can&amp;nbsp;report the exact p-value. I tried using the bestd32.31 format but still get a p rounded as 0. Any help would be much appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro combchi(df=,chi=);&lt;BR /&gt;proc iml;&lt;BR /&gt;df=&amp;amp;df;&lt;BR /&gt;g2={&amp;amp;chi};&lt;BR /&gt;m=ncol(g2);&lt;BR /&gt;g=sqrt(g2);&lt;BR /&gt;mg2=sum(g2)/m;&lt;BR /&gt;r=(1+1/m)*(ssq(g)-(sum(g)**2)/m)/(m-1);&lt;BR /&gt;f=(mg2/df - r*(m-1)/(m+1))/(1+r);&lt;BR /&gt;ddf=(m-1)*(1+1/r)**2/df**(3/m);&lt;BR /&gt;p=1-probf(f,df,ddf);&lt;BR /&gt;print f df ddf;&lt;BR /&gt;print p[format=bestd32.31];&lt;BR /&gt;quit;&lt;BR /&gt;%mend combchi;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%combchi(df=2,chi=102.997006 108.592438 105.224443 111.206028 106.644927)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output:&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;The SAS System&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;f df ddf &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;52.009228&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3641.6389&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;p &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 11 Dec 2018 14:32:20 GMT</pubDate>
    <dc:creator>greveam</dc:creator>
    <dc:date>2018-12-11T14:32:20Z</dc:date>
    <item>
      <title>BESTDw.p format in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520373#M141089</link>
      <description>&lt;P&gt;Hi, I want to format&amp;nbsp;p&amp;nbsp;in the macro below so that I can&amp;nbsp;report the exact p-value. I tried using the bestd32.31 format but still get a p rounded as 0. Any help would be much appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro combchi(df=,chi=);&lt;BR /&gt;proc iml;&lt;BR /&gt;df=&amp;amp;df;&lt;BR /&gt;g2={&amp;amp;chi};&lt;BR /&gt;m=ncol(g2);&lt;BR /&gt;g=sqrt(g2);&lt;BR /&gt;mg2=sum(g2)/m;&lt;BR /&gt;r=(1+1/m)*(ssq(g)-(sum(g)**2)/m)/(m-1);&lt;BR /&gt;f=(mg2/df - r*(m-1)/(m+1))/(1+r);&lt;BR /&gt;ddf=(m-1)*(1+1/r)**2/df**(3/m);&lt;BR /&gt;p=1-probf(f,df,ddf);&lt;BR /&gt;print f df ddf;&lt;BR /&gt;print p[format=bestd32.31];&lt;BR /&gt;quit;&lt;BR /&gt;%mend combchi;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%combchi(df=2,chi=102.997006 108.592438 105.224443 111.206028 106.644927)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output:&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;TABLE border="0" cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;The SAS System&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;f df ddf &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;52.009228&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3641.6389&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;p &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Dec 2018 14:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520373#M141089</guid>
      <dc:creator>greveam</dc:creator>
      <dc:date>2018-12-11T14:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: BESTDw.p format in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520394#M141098</link>
      <description>&lt;P&gt;The problem is not the format, it is the way you are computing the p-value.&amp;nbsp; When you compute the quantity&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p = 1 - probf(...);&lt;/P&gt;
&lt;P&gt;the PROBF function computes the left tail of the F distribution and returns 1 to within numerical precision. When you want an extreme p-value, it is more&amp;nbsp;accurate numerically to compute the RIGHT tail directly by using the SDF function:&lt;/P&gt;
&lt;P&gt;p = sdf("F", f,df,ddf);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 15:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520394#M141098</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-12-11T15:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: BESTDw.p format in proc iml</title>
      <link>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520462#M141133</link>
      <description>&lt;P&gt;You might also want to consider using the PVALUEw.d format.&lt;/P&gt;
&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/206428"&gt;@greveam&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I want to format&amp;nbsp;p&amp;nbsp;in the macro below so that I can&amp;nbsp;report the exact p-value. I tried using the bestd32.31 format but still get a p rounded as 0. Any help would be much appreciated. Thanks!&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;31 decimal places is still likely not "the exact p-value". It is the value displayed to a precision of 31 decimals. Though when fewer digits are shown it could be the result of another rounding/truncation/precision issue in the calculations involved.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 17:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/BESTDw-p-format-in-proc-iml/m-p/520462#M141133</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-11T17:41:31Z</dc:date>
    </item>
  </channel>
</rss>

