<?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 Proc means - Calculating the share / weight in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449632#M113177</link>
    <description>&lt;P&gt;I am using a proc means to calculate the share of the payments made by business line, the data looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data Test;
input ID Business_Line Payment2017;
Datalines;
1 1 1000
2 1 2000
3 1 3000
4 1 4000
5 2 500
6 2 1500
7 2 3000
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i'm looking to calculate an additional column which, by group (business_line) calculates the percentage share (weight) of the payment as such:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   data Test;
input ID Business_Line Payment2017 share;
Datalines;
1 1 1000 0.1
2 1 2000 0.2
3 1 3000 0.3
4 1 4000 0.4
5 2 500 0.1
6 2 1500 0.3
7 2 3000 0.6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the code I have used so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;proc means data = test noprint;
class ID;
by business_line;
var Payment2017;
output out=test2 
sum = share;
weight = payment2017/share;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have also tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;proc means data = test noprint;
class ID;
by business_line;
var Payment2017 /weight = payment2017;
output out=test3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;appreciate the help.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 12:49:12 GMT</pubDate>
    <dc:creator>89974114</dc:creator>
    <dc:date>2018-03-29T12:49:12Z</dc:date>
    <item>
      <title>Proc means - Calculating the share / weight</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449632#M113177</link>
      <description>&lt;P&gt;I am using a proc means to calculate the share of the payments made by business line, the data looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data Test;
input ID Business_Line Payment2017;
Datalines;
1 1 1000
2 1 2000
3 1 3000
4 1 4000
5 2 500
6 2 1500
7 2 3000
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i'm looking to calculate an additional column which, by group (business_line) calculates the percentage share (weight) of the payment as such:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   data Test;
input ID Business_Line Payment2017 share;
Datalines;
1 1 1000 0.1
2 1 2000 0.2
3 1 3000 0.3
4 1 4000 0.4
5 2 500 0.1
6 2 1500 0.3
7 2 3000 0.6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the code I have used so far:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;proc means data = test noprint;
class ID;
by business_line;
var Payment2017;
output out=test2 
sum = share;
weight = payment2017/share;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have also tried&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;proc means data = test noprint;
class ID;
by business_line;
var Payment2017 /weight = payment2017;
output out=test3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;appreciate the help.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449632#M113177</guid>
      <dc:creator>89974114</dc:creator>
      <dc:date>2018-03-29T12:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc means - Calculating the share / weight</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449634#M113178</link>
      <description>&lt;P&gt;Do it in SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select a.*, payment2017 / sum(payment2017) as share
from test a
group by business_line
order by id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449634#M113178</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-29T12:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc means - Calculating the share / weight</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449638#M113181</link>
      <description>&lt;P&gt;I always forget about SQL&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-means-Calculating-the-share-weight/m-p/449638#M113181</guid>
      <dc:creator>89974114</dc:creator>
      <dc:date>2018-03-29T13:01:09Z</dc:date>
    </item>
  </channel>
</rss>

