<?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 Comparison of means in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558884#M156006</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to compare means one by one to find out if the difference is significant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to do this by id, by period (2 periods : 1 and 2) and by a variable question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what my input looks like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
format id $15. period 1. question $20. mean_period1 mean_period2 BEST12. ;
input id period question mean_period1 mean_period2 ;
cards;
00000_11111 1 question_1 0.64 .
00000_11111 2 question_1 . 0.72
00000_11111 1 question_2 0.58 .
00000_11111 2 question_2 . 0.64
00000_22222 1 question_1 0.81 .
00000_22222 2 question_1 . 0.75
00000_22222 1 question_2 0.68 .
00000_22222 2 question_2 . 0.62
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So i want to know if there is a significant difference between the first period and the second period.. but I don't know how to do..&lt;/P&gt;&lt;P&gt;I think I have to do a test of student or maybe a chi square test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Onizuka&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2019 12:39:26 GMT</pubDate>
    <dc:creator>Onizuka</dc:creator>
    <dc:date>2019-05-15T12:39:26Z</dc:date>
    <item>
      <title>Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558884#M156006</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to compare means one by one to find out if the difference is significant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to do this by id, by period (2 periods : 1 and 2) and by a variable question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what my input looks like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
format id $15. period 1. question $20. mean_period1 mean_period2 BEST12. ;
input id period question mean_period1 mean_period2 ;
cards;
00000_11111 1 question_1 0.64 .
00000_11111 2 question_1 . 0.72
00000_11111 1 question_2 0.58 .
00000_11111 2 question_2 . 0.64
00000_22222 1 question_1 0.81 .
00000_22222 2 question_1 . 0.75
00000_22222 1 question_2 0.68 .
00000_22222 2 question_2 . 0.62
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So i want to know if there is a significant difference between the first period and the second period.. but I don't know how to do..&lt;/P&gt;&lt;P&gt;I think I have to do a test of student or maybe a chi square test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Onizuka&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 12:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558884#M156006</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T12:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558886#M156007</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269468"&gt;@Onizuka&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to compare means one by one to find out if the difference is significant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to do this by id, by period (2 periods : 1 and 2) and by a variable question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what my input looks like :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
format id $15. period 1. question $20. mean_period1 mean_period2 BEST12. ;
input id period question mean_period1 mean_period2 ;
cards;
00000_11111 1 question_1 0.64 .
00000_11111 2 question_1 . 0.72
00000_11111 1 question_2 0.58 .
00000_11111 2 question_2 . 0.64
00000_22222 1 question_1 0.81 .
00000_22222 2 question_1 . 0.75
00000_22222 1 question_2 0.68 .
00000_22222 2 question_2 . 0.62
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have only one data value for each combination of id, period and question, then there is no such thing as a statistical comparison of the means. Do you have, in real life (as opposed to this small data set) multiple observations for each combination of id, period and question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So i want to know if there is a significant difference between the first period and the second period.. but I don't know how to do..&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is not the same question as discussed above, which said "I have to do this by id, by period (2 periods : 1 and 2) and by a variable question". So please clarify exactly what you want.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 12:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558886#M156007</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-15T12:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558888#M156008</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have calculated the mean on a sql procedure grouping by id, period and question so, yes I Have a previous table where I have multiple observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes my bad, i want to know if the difference is significant grouping by id, period and question to say something like :&lt;/P&gt;&lt;P&gt;"For the id 00000_11111, and the question number 1, we can see a significant difference of the mean between period 1&amp;nbsp; (example : february 2019) et period 2 (example : january 2019)&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 12:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558888#M156008</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T12:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558889#M156009</link>
      <description>&lt;P&gt;PROC SQL doesn't let you compare means statistically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to take your original data and use PROC TTEST, with&amp;nbsp; &lt;FONT face="courier new,courier"&gt;BY ID PERIOD QUESTION;&lt;/FONT&gt; statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples are here:&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_examples.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_examples.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_gettingstarted.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_gettingstarted.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 12:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558889#M156009</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-15T12:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558894#M156012</link>
      <description>&lt;P&gt;I have already saw the documentation ^^'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what i have tried :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ttest data = p1_p2 ;
by code_niv per question ;
var restsi restsi2; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this is what the log look like :&lt;/P&gt;&lt;PRE&gt;1150  proc ttest data = p1_p2 ;
1151  by code_niv per question ;
1152  var restsi restsi2;
1153  run ;

WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: Some graphs could not be produced due to lack of observations with valid response
         values.
NOTE: The above message was for the following BY group:
      code_niv=10907 per=1 question=cim_q10
WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: Some graphs could not be produced due to lack of observations with valid response
         values.
NOTE: The above message was for the following BY group:
      code_niv=10907 per=1 question=cim_q11
WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: There are insufficient nonmissing observations to create a density plot.
WARNING: Some graphs could not be produced due to lack of observations with valid response
         values.
NOTE: The above message was for the following BY group:
      code_niv=10907 per=1 question=cim_q12b&lt;/PRE&gt;&lt;P&gt;EDIT :&lt;/P&gt;&lt;P&gt;Then i have tried this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data = P1_P2 noprint ;
var restsi restsi2 ;
by code_niv per question;
output out = test100000 ;
run ;

proc sort data = test100000 ; by code_niv per question ; run ;
proc ttest data = test100000 ;
by code_niv per question ;
var restsi restsi2; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but all the results are missing for the ttest procedure&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558894#M156012</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T13:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558897#M156013</link>
      <description>&lt;P&gt;Show us a portion of your dataset p1_p2.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558897#M156013</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-15T13:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558901#M156014</link>
      <description>&lt;P&gt;yes, i reply in a few minutes, my SAS crashed after the code i have runned haha&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558901#M156014</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T13:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558904#M156015</link>
      <description>&lt;P&gt;Here an extract :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29539i83DC7B94258CE8F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here an extract sorted by code_niv (id) period and question :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29540i4C5AB6066FABA5C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558904#M156015</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T13:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558915#M156021</link>
      <description>&lt;P&gt;As far as I can determine, you still have only one data point for each combination of Code_NIV PER and QUESTION.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also please clarify: Are the data sets you showed really P1_P2 or the data set TEST100000? I specifically asked for P1_P2.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558915#M156021</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-15T13:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558917#M156022</link>
      <description>&lt;P&gt;Yes you are right, my mistake..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what are my possibilities ?&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/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;As far as I can determine, you still have only one data point for each combination of Code_NIV PER and QUESTION.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also please clarify: Are the data sets you showed really P1_P2 or the data set TEST100000? I specifically asked for P1_P2.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;TEST1000000 is the output of the proc means, what i show to you is P1_P2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The proc means doens't calculate the variance, i have decided (i think it is better) to have only one variable (restsi which contain restsi and restsi2) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data P1_P2_ (drop = restsi2);
set P1_P2 ;
if restsi = . then restsi = restsi2 ; 
run ;

Proc means data = P1_P2_ noprint ;
var restsi ;
by code_niv per question ;
output out = test1000000;
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here an extract of P1_P2_ :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29542i5817DB0630ED2FC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and here an extract of TEST100000 (from the proc means with P1_P2_)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29543iE641F12075274C94/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 13:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558917#M156022</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T13:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558979#M156051</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269468"&gt;@Onizuka&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes you are right, my mistake..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know what are my possibilities ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There is no way to statistically compare means if you have only a single data point in each combination of variables of interest.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 14:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558979#M156051</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-15T14:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558980#M156052</link>
      <description>&lt;P&gt;I permit me to up the topic ..&lt;/P&gt;&lt;P&gt;Someone has an idea ? :X&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 14:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/558980#M156052</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-15T14:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/559316#M156167</link>
      <description>&lt;P&gt;Ok.. Thank you for the answer&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 14:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-means/m-p/559316#M156167</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-16T14:03:42Z</dc:date>
    </item>
  </channel>
</rss>

