<?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: Means by Variables and overall (mean) using proc summary in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763169#M241680</link>
    <description>&lt;P&gt;I cannot figure out what statistic you want in that first column. Here is want the raw output of PROC MEANS/SUMMARY can easily produce.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have ;
  class gender;
  var score1 score2;
  output out=want mean= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    Gender    _TYPE_    _FREQ_    Score1    Score2

 1                  0         4       7.75       8.25
 2       F          1         2       7.00      10.00
 3       M          1         2       8.50       6.50
&lt;/PRE&gt;</description>
    <pubDate>Sun, 22 Aug 2021 18:04:21 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-08-22T18:04:21Z</dc:date>
    <item>
      <title>Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763161#M241675</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Could you pls suggest me how can i get Overall mean and mean for scores by Gender using PROC SUMMARY. See the&amp;nbsp; dataset and the output tables i want; I'm struggling to get the Overall Mean for Score1 and Score 2 according to Gender (Male, Female).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Made;&lt;/P&gt;
&lt;TABLE width="155"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="35"&gt;ID&lt;/TD&gt;
&lt;TD width="25"&gt;Gender&lt;/TD&gt;
&lt;TD width="45"&gt;Score1&lt;/TD&gt;
&lt;TD width="50"&gt;Score2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="35"&gt;101&lt;/TD&gt;
&lt;TD width="25"&gt;M&lt;/TD&gt;
&lt;TD width="45"&gt;10&lt;/TD&gt;
&lt;TD width="50"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="35"&gt;102&lt;/TD&gt;
&lt;TD width="25"&gt;F&lt;/TD&gt;
&lt;TD width="45"&gt;9&lt;/TD&gt;
&lt;TD width="50"&gt;12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="35"&gt;103&lt;/TD&gt;
&lt;TD width="25"&gt;M&lt;/TD&gt;
&lt;TD width="45"&gt;7&lt;/TD&gt;
&lt;TD width="50"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="35"&gt;104&lt;/TD&gt;
&lt;TD width="25"&gt;F&lt;/TD&gt;
&lt;TD width="45"&gt;5&lt;/TD&gt;
&lt;TD width="50"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output want;&lt;/P&gt;
&lt;TABLE width="302"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Gender&amp;nbsp;&lt;/TD&gt;
&lt;TD width="62"&gt;All&lt;BR /&gt;(mean)&lt;/TD&gt;
&lt;TD width="88"&gt;Score1&lt;BR /&gt;(mean)&lt;/TD&gt;
&lt;TD width="88"&gt;Score2&lt;BR /&gt;(mean)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;M&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Total (mean)&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Akter&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 16:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763161#M241675</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-08-22T16:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763163#M241676</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here you are:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $ Gender $ Score1 Score2;
cards;
101	M	10	8
102	F	9	12
103	M	7	5
104	F	5	8
;
run;

PROC SUMMARY data=have;
 CLASS Gender;
 var Score: ;
 output out=summary_want;
run;

PROC PRINT data=summary_want;
 where _STAT_='MEAN';
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Have a nice Sunday evening!&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 16:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763163#M241676</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-22T16:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763164#M241677</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(See also previous reply!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you want this? (It's not very clear from your question).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $ Gender $ Score1 Score2;
cards;
101	M	10	8
102	F	9	12
103	M	7	5
104	F	5	8
;
run;

PROC SUMMARY data=have;
 CLASS Gender;
 var Score: ;
 output out=summary_want(where=(_STAT_='MEAN') drop=_TYPE_ _FREQ_);
run;

data summary_want;
 set summary_want;
 MeanScore1Score2 = mean(Score1,Score2);
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 16:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763164#M241677</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-22T16:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763167#M241678</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On top of the previous 2 replies I have given,&lt;/P&gt;
&lt;P&gt;see here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Tip: Many Means to a Mean&lt;BR /&gt;Posted 02-12-2018 02:07 PM&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Many-Means-to-a-Mean/m-p/436417#M107" target="_blank"&gt;https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Many-Means-to-a-Mean/m-p/436417#M107&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 17:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763167#M241678</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-22T17:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763168#M241679</link>
      <description>&lt;P&gt;What is it you want in that first output column you have labeled ALL?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 17:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763168#M241679</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-22T17:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763169#M241680</link>
      <description>&lt;P&gt;I cannot figure out what statistic you want in that first column. Here is want the raw output of PROC MEANS/SUMMARY can easily produce.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have ;
  class gender;
  var score1 score2;
  output out=want mean= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    Gender    _TYPE_    _FREQ_    Score1    Score2

 1                  0         4       7.75       8.25
 2       F          1         2       7.00      10.00
 3       M          1         2       8.50       6.50
&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Aug 2021 18:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763169#M241680</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-22T18:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Means by Variables and overall (mean) using proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763170#M241681</link>
      <description>&lt;P&gt;Thank you. You all are so nice!&lt;/P&gt;</description>
      <pubDate>Sun, 22 Aug 2021 18:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Means-by-Variables-and-overall-mean-using-proc-summary/m-p/763170#M241681</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-08-22T18:10:33Z</dc:date>
    </item>
  </channel>
</rss>

