<?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 Find the cumulative sum (Running total) of given data set values using SQL...? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589510#M168629</link>
    <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone please advise how to get Cumulative sum(Running total) of below given data set in &lt;STRONG&gt;Proc SQL...?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;CODE class=" language-sas"&gt;data a;
input emp$ sal;
cards;
emp1 1000000
emp2 2000000
emp3 3000000
;run;

data b;
input emp$ sal;
cards;
emp1 1000000
emp3 7000000
emp4 4000000
;run;

data c;
merge a b;
by emp;
total+sal;
run;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;output should be like below:&lt;/P&gt;&lt;P&gt;--emp--+---sal--+----total--+-&lt;/P&gt;&lt;P&gt;emp1 1000000 1000000&lt;BR /&gt;emp2 2000000 3000000&lt;BR /&gt;emp3 7000000 10000000&lt;BR /&gt;emp4 4000000 14000000&lt;/P&gt;&lt;P&gt;------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;varmal&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (9).png" style="width: 297px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32546i7595B8FBD1727F6D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (9).png" alt="Screenshot (9).png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2019 02:13:12 GMT</pubDate>
    <dc:creator>varmalh</dc:creator>
    <dc:date>2019-09-18T02:13:12Z</dc:date>
    <item>
      <title>Find the cumulative sum (Running total) of given data set values using SQL...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589510#M168629</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone please advise how to get Cumulative sum(Running total) of below given data set in &lt;STRONG&gt;Proc SQL...?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;CODE class=" language-sas"&gt;data a;
input emp$ sal;
cards;
emp1 1000000
emp2 2000000
emp3 3000000
;run;

data b;
input emp$ sal;
cards;
emp1 1000000
emp3 7000000
emp4 4000000
;run;

data c;
merge a b;
by emp;
total+sal;
run;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;output should be like below:&lt;/P&gt;&lt;P&gt;--emp--+---sal--+----total--+-&lt;/P&gt;&lt;P&gt;emp1 1000000 1000000&lt;BR /&gt;emp2 2000000 3000000&lt;BR /&gt;emp3 7000000 10000000&lt;BR /&gt;emp4 4000000 14000000&lt;/P&gt;&lt;P&gt;------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;varmal&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot (9).png" style="width: 297px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32546i7595B8FBD1727F6D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot (9).png" alt="Screenshot (9).png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 02:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589510#M168629</guid>
      <dc:creator>varmalh</dc:creator>
      <dc:date>2019-09-18T02:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Find the cumulative sum (Running total) of given data set values using SQL...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589515#M168630</link>
      <description>&lt;P&gt;Proc SQL is not a good way to get a cumulative total . You already have the most elegant solution using data step -&amp;nbsp; why do you need to use Proc SQL?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 03:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589515#M168630</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-09-18T03:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find the cumulative sum (Running total) of given data set values using SQL...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589524#M168638</link>
      <description>&lt;P&gt;SQL is not very good at processing rows in a given order. For this reason a data step is better suited as mentioned.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 05:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589524#M168638</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-09-18T05:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Find the cumulative sum (Running total) of given data set values using SQL...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589871#M168769</link>
      <description>&lt;P&gt;I understand you point but there must a simple or complex way of getting the same output..?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 01:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589871#M168769</guid>
      <dc:creator>varmalh</dc:creator>
      <dc:date>2019-09-19T01:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Find the cumulative sum (Running total) of given data set values using SQL...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589874#M168772</link>
      <description>&lt;P&gt;The simple way is using data step . Yes it can be done using Proc SQL but it is not a good way to tackle the problem . Just like you wouldn't eat soup with a fork .&amp;nbsp;Why do you want to user Proc SQL?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 01:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-the-cumulative-sum-Running-total-of-given-data-set-values/m-p/589874#M168772</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-09-19T01:28:56Z</dc:date>
    </item>
  </channel>
</rss>

