<?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 Average versus weighted avg in SAS E.G. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Average-versus-weighted-avg-in-SAS-E-G/m-p/776410#M246927</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with making weighted averages shown.&lt;/P&gt;&lt;P&gt;I have 3 parameters - EAD (a number), LGD (a number) and PD (a series of percentages). These are in a sas-dataset of which the output has been verified and is known to be correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Needed is, for each of the 3, their averages produced but not normal averages; but weighted avg ; weighted by exposure total (EAD-total).&lt;/P&gt;&lt;P&gt;It takes a grouping sum to sort it out.&lt;/P&gt;&lt;P&gt;Can anyone explain to me how this works?&lt;/P&gt;&lt;P&gt;I found out how to do; made 1 example calculation using proc means + keyword weight.&lt;/P&gt;&lt;P&gt;But stakeholders requested to see it done manually by use of the querybuilders which are graphically available in SAS EnterpriseGuide rather than by code.&lt;/P&gt;&lt;P&gt;And I have been staring at the problem for a while but I cannot seem to get it done with graphic user-interface SAS E.G. querybuilders, so. Does anyone have a code and example data for me? I'm on SAS E.G. v8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; best regards,&lt;/P&gt;&lt;P&gt;Heleen&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 09:43:31 GMT</pubDate>
    <dc:creator>heleenw</dc:creator>
    <dc:date>2021-10-26T09:43:31Z</dc:date>
    <item>
      <title>Average versus weighted avg in SAS E.G.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Average-versus-weighted-avg-in-SAS-E-G/m-p/776410#M246927</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with making weighted averages shown.&lt;/P&gt;&lt;P&gt;I have 3 parameters - EAD (a number), LGD (a number) and PD (a series of percentages). These are in a sas-dataset of which the output has been verified and is known to be correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Needed is, for each of the 3, their averages produced but not normal averages; but weighted avg ; weighted by exposure total (EAD-total).&lt;/P&gt;&lt;P&gt;It takes a grouping sum to sort it out.&lt;/P&gt;&lt;P&gt;Can anyone explain to me how this works?&lt;/P&gt;&lt;P&gt;I found out how to do; made 1 example calculation using proc means + keyword weight.&lt;/P&gt;&lt;P&gt;But stakeholders requested to see it done manually by use of the querybuilders which are graphically available in SAS EnterpriseGuide rather than by code.&lt;/P&gt;&lt;P&gt;And I have been staring at the problem for a while but I cannot seem to get it done with graphic user-interface SAS E.G. querybuilders, so. Does anyone have a code and example data for me? I'm on SAS E.G. v8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; best regards,&lt;/P&gt;&lt;P&gt;Heleen&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 09:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Average-versus-weighted-avg-in-SAS-E-G/m-p/776410#M246927</guid>
      <dc:creator>heleenw</dc:creator>
      <dc:date>2021-10-26T09:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average versus weighted avg in SAS E.G.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Average-versus-weighted-avg-in-SAS-E-G/m-p/776417#M246933</link>
      <description>&lt;P&gt;See an example how you work with weighted averages:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input group value;
datalines;
1 3
1 5
2 6
2 8
2 10
;

proc sql;
create table weighted as
  select group, mean(value) as value, count(*) as weight
  from have
  group by group
;
select mean(value) as want1
from have;
select sum(value*weight) / sum(weight) as want2
from weighted;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Oct 2021 09:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Average-versus-weighted-avg-in-SAS-E-G/m-p/776417#M246933</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-26T09:59:41Z</dc:date>
    </item>
  </channel>
</rss>

