<?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: Running Total in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210509#M307014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark, not sure this willl work as the key_hedge will change and it's best not to keep adding in the cards each time &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jul 2015 15:21:50 GMT</pubDate>
    <dc:creator>anonymous_user</dc:creator>
    <dc:date>2015-07-24T15:21:50Z</dc:date>
    <item>
      <title>Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210505#M307010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to capture a running_sum but unsure how to against the key_hedge and Dealt_amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key_hedge and Dealt amount are in a table called static_summit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas please?&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="371"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="132"&gt;Key_hedge&lt;/TD&gt;&lt;TD width="147"&gt;Dealt_amount&lt;/TD&gt;&lt;TD width="92"&gt;Running_sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421240GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;15,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421242GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;421242GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1,000,000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 08:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210505#M307010</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2015-07-24T08:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210506#M307011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I guess right then:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by key_hedge;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain running_sum;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.key_hedge then running_sum=dealt_amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else running_sum=running_sum+dealt_amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 09:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210506#M307011</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-07-24T09:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210507#M307012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go, this is set up to start the running_sum as new for every new key_hedge, if that is not what you want you should remove the line that starts with 'if'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;format Key_hedge $14. Dealt_amount comma10.;&lt;/P&gt;&lt;P&gt;input Key_hedge$&amp;nbsp;&amp;nbsp;&amp;nbsp; Dealt_amount;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;421240GapClose,15000000&lt;/P&gt;&lt;P&gt;421241GapClose,1000000&lt;/P&gt;&lt;P&gt;421241GapClose,1000000&lt;/P&gt;&lt;P&gt;421241GapClose,1000000&lt;/P&gt;&lt;P&gt;421241GapClose,1000000&lt;/P&gt;&lt;P&gt;421241GapClose,1000000&lt;/P&gt;&lt;P&gt;421242GapClose,1000000&lt;/P&gt;&lt;P&gt;421242GapClose,1000000&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;format Key_hedge $14. Dealt_amount Running_sum comma10.;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by key_hedge;&lt;/P&gt;&lt;P&gt;if first.key_hedge then running_sum = 0;&lt;/P&gt;&lt;P&gt;running_sum + dealt_amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 13:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210507#M307012</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-24T13:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210508#M307013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code doesn't seem to work. I have running_sum and dealt_amount all blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe I wasn't too clear originally .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key_hedge and Dealt_amount are vaiables im pulling in from a table Summit static.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running_sum doesn't exist so im needing to create this variable. I have manually added the data within the running sum as to what it is i need to see but the code above doesn't do this. &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 371px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;" width="132"&gt;Key_hedge&lt;/TD&gt;&lt;TD style="border: black 0px solid;" width="147"&gt;Dealt_amount&lt;/TD&gt;&lt;TD style="border: black 0px solid;" width="92"&gt;Running_sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421240GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;15,000,000&lt;/TD&gt;&lt;TD&gt;15000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;1000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;2000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;3000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;4000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421241GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;5000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421242GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;1000000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20" style="border: black 0px solid;"&gt;421242GapClose&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border: black 0px solid;"&gt;1,000,000&lt;/TD&gt;&lt;TD&gt;2000000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 15:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210508#M307013</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2015-07-24T15:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210509#M307014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark, not sure this willl work as the key_hedge will change and it's best not to keep adding in the cards each time &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 15:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210509#M307014</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2015-07-24T15:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210510#M307015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don;t see any reason why the code would not work, the data is sorted by key_hedge yes?&amp;nbsp; And dealt amount is numeric yes?&amp;nbsp; If so this should work:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by key_hedge;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain running_sum;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.key_hedge then running_sum=dealt_amount;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else running_sum=sum(running_sum,dealt_amount);&amp;nbsp; /* Maybe change to this also in case your first value is 0 */&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If it doesn't please post test data - as a datastep - so I can test it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 15:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210510#M307015</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-07-24T15:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210511#M307016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The CARDS is used to generate sample data (HAVE) for testing. The second data step is what you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 15:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210511#M307016</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-24T15:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210512#M307017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data was added using cards only to show an example. How's this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data whatever;&lt;/P&gt;&lt;P&gt;set static_summit;&lt;/P&gt;&lt;P&gt;by key_hedge;&lt;/P&gt;&lt;P&gt;if first.key_hedge then running_sum = 0;&lt;/P&gt;&lt;P&gt;running_sum + dealt_amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2015 15:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/210512#M307017</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-24T15:26:47Z</dc:date>
    </item>
  </channel>
</rss>

