<?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 how to get the mean value per sale group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655665#M196716</link>
    <description>&lt;P&gt;data shoerange;&lt;BR /&gt;set sashelp.shoes;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value salegrp&lt;BR /&gt;0 - &amp;lt; 100000 = 'Lower'&lt;BR /&gt;100000 - 200000= 'Middle'&lt;BR /&gt;other ='Upper'&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=shoerange;&lt;BR /&gt;format sales salegrp.;&lt;BR /&gt;table sales;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does someone know what I should add to that code to get the mean value of the middle sale group?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 00:23:56 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2020-06-10T00:23:56Z</dc:date>
    <item>
      <title>how to get the mean value per sale group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655665#M196716</link>
      <description>&lt;P&gt;data shoerange;&lt;BR /&gt;set sashelp.shoes;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value salegrp&lt;BR /&gt;0 - &amp;lt; 100000 = 'Lower'&lt;BR /&gt;100000 - 200000= 'Middle'&lt;BR /&gt;other ='Upper'&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=shoerange;&lt;BR /&gt;format sales salegrp.;&lt;BR /&gt;table sales;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does someone know what I should add to that code to get the mean value of the middle sale group?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655665#M196716</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-06-10T00:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the mean value per sale group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655672#M196718</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp; For mean value, shouldn't you be looking at Proc means/summary rather than proc freq. Or am i missing something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;


data shoerange;
set sashelp.shoes;
run;

proc format;
value salegrp
0 - &amp;lt; 100000 = 'Lower'
100000 - 200000= 'Middle'
other ='Upper'
;
run;

proc means data=shoerange nway mean;
class sales ;
var sales ;
format sales salegrp.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655672#M196718</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-10T00:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the mean value per sale group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655673#M196719</link>
      <description>&lt;P&gt;PROC FREQ provides frequencies of categorical variables, not the mean (or std, min, max, range, etc.) of interval/cardinal variables.&amp;nbsp; You should use something like proc means:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data shoerange;
  set sashelp.shoes;
  if sales  &amp;gt;=200000 then group='Upper ';  else
  if sales  &amp;gt;=100000 then group='Middle'; else
  if sales  &amp;gt;=0       then group='Lower ';
run;
proc means;
  var sales;
  class group;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because the same original variable (SALES) is used both for classification and as the analysis variable, the most direct solution is to make a second variable (group) and use it in the CLASS statement.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655673#M196719</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-06-10T00:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the mean value per sale group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655675#M196721</link>
      <description>&lt;P&gt;Freq doesn’t do means, but means does counts.&amp;nbsp;&lt;BR /&gt;I don’t know if the second set of code works here but I wouldn’t expect it to. You can create a new variable that’s identical and use It instead of sales.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc means data = shoerange ;
Var sales;
Run; 

Proc means data = shoerange;
Class sales;
Format sales salegrp.;
Var sales;
Run;

Data shoerange;
Set sadhelp.shoes;
Sales_grp = sales;
Format sales_grp salesgrp.;
Run;

Proc means data = shoerange;
Class sales_grp;
Var sales;
Run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-mean-value-per-sale-group/m-p/655675#M196721</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-10T00:42:27Z</dc:date>
    </item>
  </channel>
</rss>

