<?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: Code to get table of sum of one variable that belongs to category in another variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556727#M155113</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
format balance 3. movement $6. ;
input balance movement ;
cards;
500 1_to_1
300 1_to_2
200 2_to_1
500 2_to_2
400 1_to_2
250 2_to_1
125 3_to_1
600 3_to_2
350 3_to_1
;
run ;

Proc sql ;
create table want as 
select sum(balance) as sum, movement
from have
group by movement ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 May 2019 10:31:46 GMT</pubDate>
    <dc:creator>Onizuka</dc:creator>
    <dc:date>2019-05-07T10:31:46Z</dc:date>
    <item>
      <title>Code to get table of sum of one variable that belongs to category in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556721#M155110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please provide me with the code (the dataset: data=APRIL_PROJECT) so that I can see the sum of the 'BALANCE' variable ('BALANCE' is a numeric variable) that belongs to each of the categories in the 'MOVEMENT' variable ('MOVEMENT' is a character variable) i.e. there would be a table that shows that the sum/total balance would be 700 for '1 to 2' (300+400) and 450 for '2 to 1' (200+250) etc. Thanks.&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="BALANCE and MOVEMENT..PNG" style="width: 248px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29253i3047FE8D2B841512/image-size/large?v=v2&amp;amp;px=999" role="button" title="BALANCE and MOVEMENT..PNG" alt="BALANCE and MOVEMENT..PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 10:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556721#M155110</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-05-07T10:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Code to get table of sum of one variable that belongs to category in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556727#M155113</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
format balance 3. movement $6. ;
input balance movement ;
cards;
500 1_to_1
300 1_to_2
200 2_to_1
500 2_to_2
400 1_to_2
250 2_to_1
125 3_to_1
600 3_to_2
350 3_to_1
;
run ;

Proc sql ;
create table want as 
select sum(balance) as sum, movement
from have
group by movement ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 10:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556727#M155113</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-07T10:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code to get table of sum of one variable that belongs to category in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556730#M155114</link>
      <description>&lt;P&gt;I delete my previous message because it was false, my solution is working now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here the output :&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: 198px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29260i850278C52A03D53E/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>Tue, 07 May 2019 10:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556730#M155114</guid>
      <dc:creator>Onizuka</dc:creator>
      <dc:date>2019-05-07T10:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Code to get table of sum of one variable that belongs to category in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556731#M155115</link>
      <description>&lt;P&gt;PROC MEANS/PROC SUMMARY was designed to do things like this, and is a basic fundamental SAS tool that (in my opinion) everyone should know. Example is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p070bkysj4lkyun0zxj45n643q1i.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p070bkysj4lkyun0zxj45n643q1i" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p070bkysj4lkyun0zxj45n643q1i.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p070bkysj4lkyun0zxj45n643q1i&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 12:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-get-table-of-sum-of-one-variable-that-belongs-to/m-p/556731#M155115</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-07T12:17:18Z</dc:date>
    </item>
  </channel>
</rss>

