<?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: 95% CI for means : direct output from proc means is different to calculated in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/357010#M18751</link>
    <description>&lt;P&gt;Thank you for pointing out the mistake in the paper. Now I&amp;nbsp;don't feel confused any more.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2017 20:26:31 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2017-05-08T20:26:31Z</dc:date>
    <item>
      <title>95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356980#M18747</link>
      <description>&lt;P&gt;In this paper&amp;nbsp;&lt;A href="http://www.lexjansen.com/pharmasug/2003/Posters/P048.pdf" target="_blank"&gt;http://www.lexjansen.com/pharmasug/2003/Posters/P048.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;the author said that to get the 95% CI of the mean, it is the best to get N , Mean and Stdeer and use TINV function to calculate. This will get a narrower 95% CI for the mean compared to proc means or proc summary.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How did Proc Means or proc summary calculate the 95% CI for the mean?&lt;/P&gt;
&lt;P&gt;In reality, which method is more often used?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*** three methods to get 95% CI for mean;

DATA test ;
INPUT subjno trt age ;
CARDS ;
1 1 25
2 2 30
3 1 15
4 1 45
5 2 22
6 2 54
;
RUN ;
PROC SORT DATA = test;
BY trt ;
RUN ;

*** method one: use proc means;

PROC MEANS DATA=test NOPRINT ;
BY trt ;
VAR age ;
OUTPUT OUT=xxtmp N=n MEAN=mean
STDERR=stderr LCLM=lclm Uclm=uclm ;
RUN ;

*** method two: use proc summary;

PROC SUMMARY DATA=test NOPRINT;
BY trt;
VAR age;
OUTPUT OUT=xxtmps N=n MEAN=mean
STDERR=stderr LCLM=lclm UCLM=uclm;
RUN;

*** method three: use proc summary - this is the correct one;
PROC MEANS DATA=test NOPRINT;
BY trt ;
VAR age ;
OUTPUT OUT=xxtmp_1 N=n MEAN=mean
STDERR=stderr LCLM=lclm UCLM=uclm ;
RUN ;

DATA xxtmp_2 ;
SET xxtmp_1;
lo = mean - ( TINV ( 0.95 , n-1 ) * stderr ) ;
hi = mean + ( TINV ( 0.95 , n-1 ) * stderr ) ;
RUN ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 19:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356980#M18747</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-08T19:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356992#M18748</link>
      <description>&lt;P&gt;I get a "not found" error for your link.&lt;/P&gt;
&lt;P&gt;I wonder if this alternative is for a specific purpose but can't check as the link doesn't seem to work, at least for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look in the online help for "Keywords and Formulas" in the SAS Elementary Statistic Procedures.&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 19:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356992#M18748</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-08T19:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356995#M18749</link>
      <description>&lt;P&gt;you can copy and paste the URL and it works. &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I just fixed the link&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 19:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/356995#M18749</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-08T19:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/357002#M18750</link>
      <description>&lt;P&gt;I fixed it, but may have overridden yours.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, the paper is wrong - it's doing alpha=0.1 not alpha=0.05. The calculation happening is for a 90% confidence interval, not 95%.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the 95% in the TINV function, for a two sided test it should 1-alpha/2 = 0.975 NOT 0.95. Once everything is the same the numbers from proc means match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'method one: use proc means, alpha = 0.05, two sided test';

PROC MEANS DATA=sashelp.class n mean stderr lclm uclm alpha=0.05 vardef=df;
 class sex;
 VAR height; 
 OUTPUT OUT=xxtmp N=n MEAN=mean STDERR=stderr LCLM=lclm Uclm=uclm;
RUN;

*** method three: use proc summary - this is the correct one;

PROC MEANS DATA=sashelp.class noprint;
 class sex;
 VAR height;
 OUTPUT OUT=xxtmp_1 N=n MEAN=mean STDERR=stderr LCLM=lclm UCLM=uclm;
RUN;

DATA xxtmp_2;
 SET xxtmp_1;
 lo=mean - (TINV (0.975 , n-1) * stderr);
 hi=mean + (TINV (0.975 , n-1) * stderr);
RUN;

title 'method two: use proc summary - this is the correct one';

proc print data=xxtmp_2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 May 2017 19:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/357002#M18750</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-08T19:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/357010#M18751</link>
      <description>&lt;P&gt;Thank you for pointing out the mistake in the paper. Now I&amp;nbsp;don't feel confused any more.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 20:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/357010#M18751</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2017-05-08T20:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/430104#M22607</link>
      <description>&lt;P&gt;The reply is strictly speaking still incorrect in the code , as you state your going to use&amp;nbsp;&lt;FONT color="#ff0000"&gt;proc summary&lt;/FONT&gt;, but in fact you've repeated proc &lt;STRONG&gt;means&lt;/STRONG&gt; twice.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/430104#M22607</guid>
      <dc:creator>Suki99</dc:creator>
      <dc:date>2018-01-23T18:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: 95% CI for means : direct output from proc means is different to calculated</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/430111#M22608</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188649"&gt;@Suki99&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The reply is strictly speaking still incorrect in the code , as you state your going to use&amp;nbsp;&lt;FONT color="#ff0000"&gt;proc summary&lt;/FONT&gt;, but in fact you've repeated proc &lt;STRONG&gt;means&lt;/STRONG&gt; twice.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC MEANS and SUMMARY are interchangeable in this context.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/95-CI-for-means-direct-output-from-proc-means-is-different-to/m-p/430111#M22608</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-23T18:32:19Z</dc:date>
    </item>
  </channel>
</rss>

