<?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: Create multiple cumulative subtotals in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117652#M32428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your explanation helps.&amp;nbsp; Here is one possibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cumulative_subtotal=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; retain cumulative_subtotal_id 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array need {3} ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if cumulative_subtotal_id = 0 then total_need = 9999999999999999;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else total_need = need{cumulative_subtotal_id};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (cumulative_subtotal &amp;gt;= total_need);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cumulative_subtotal + amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cumulative_subtotal_id + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if cumulative_subtotal_id &amp;gt; 3 then cumulative_subtotal_id=0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's untested code, so you may need to tweak it.&amp;nbsp; But it should have enough working pieces.&amp;nbsp; Usually when a program is this clunky there is an easier way.&amp;nbsp; I'm just not seeing it right now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Oct 2013 16:48:30 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2013-10-21T16:48:30Z</dc:date>
    <item>
      <title>Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117647#M32423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-size: 10pt; font-family: Helvetica; background-color: white;"&gt;Hello All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="font-size: 10pt; font-family: Helvetica; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica; background-color: white;"&gt;I have this dataset:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="margin-left: 2.75pt; width: 256px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;Case&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Amount&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;1&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;2&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;12&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;3&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;4&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;5&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;6&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And need your help to obtain &lt;STRONG&gt;C&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;umulative&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;&lt;STRONG&gt;_subtotal&lt;/STRONG&gt; and &lt;STRONG style="font-size: 10.0pt; font-family: Arial;"&gt;Cumulative_subtotal_id&lt;/STRONG&gt; fields&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="margin-left: 2.75pt; width: 519px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;Case&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Amount&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Need3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: Arial;"&gt;Cumulative&lt;/STRONG&gt;&lt;STRONG style="font-size: 10.0pt; font-family: Arial;"&gt;_subtotal&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: Arial;"&gt;Cumulative_subtotal_id&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #0000ff;"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;SPAN style="color: #ff0000;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="color: #ff0000; font-size: 10.0pt; font-family: Arial;"&gt;12&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;12&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;SPAN style="color: #ff0000;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;22&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #ff0000;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;SPAN style="color: #00ff00;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;SPAN style="color: #00ff00;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;13&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial; color: #00ff00;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;6&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;20&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;15&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="64"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;10&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="123"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="padding: 0 3.5pt 0 3.5pt;" valign="bottom" width="140"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create multiple cumulative subtotals of amount that cover/hedge Needi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Cumulative&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;_subtotal=30&amp;gt;=Need1=20 end of id=1; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;Cumulative&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Arial;"&gt;_subtotal=22&amp;gt;=Need2=15 &lt;SPAN style="font-family: Arial;"&gt;end of id=2; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Cumulative&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;_subtotal=13&amp;gt;=Need3=10 &lt;SPAN style="font-family: Arial;"&gt;end of id=3&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;C&lt;SPAN style="font-family: Arial;"&gt;umulative_subtotal_id&lt;/SPAN&gt;=0 means not needed.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10.0pt; font-family: Arial;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Oct 2013 22:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117647#M32423</guid>
      <dc:creator>PC</dc:creator>
      <dc:date>2013-10-19T22:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117648#M32424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please explain your problem a bit more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is cove/hedge etc..&lt;/P&gt;&lt;P&gt;Please put some usuable sample data&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 02:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117648#M32424</guid>
      <dc:creator>Mit</dc:creator>
      <dc:date>2013-10-21T02:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117649#M32425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What in the data tells that an id group is starting or ending?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 15:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117649#M32425</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-10-21T15:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117650#M32426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;More details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="4407" alt="sas example.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/4407_sas example.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 15:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117650#M32426</guid>
      <dc:creator>PC</dc:creator>
      <dc:date>2013-10-21T15:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117651#M32427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An id identifies a subtotal: amounts that fill needi must have id=i. The id=i&amp;nbsp; ends when amount is no longer required for fill needi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 15:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117651#M32427</guid>
      <dc:creator>PC</dc:creator>
      <dc:date>2013-10-21T15:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117652#M32428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your explanation helps.&amp;nbsp; Here is one possibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cumulative_subtotal=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; retain cumulative_subtotal_id 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array need {3} ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if cumulative_subtotal_id = 0 then total_need = 9999999999999999;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else total_need = need{cumulative_subtotal_id};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (cumulative_subtotal &amp;gt;= total_need);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cumulative_subtotal + amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cumulative_subtotal_id + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if cumulative_subtotal_id &amp;gt; 3 then cumulative_subtotal_id=0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's untested code, so you may need to tweak it.&amp;nbsp; But it should have enough working pieces.&amp;nbsp; Usually when a program is this clunky there is an easier way.&amp;nbsp; I'm just not seeing it right now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 16:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117652#M32428</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-10-21T16:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple cumulative subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117653#M32429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Astounding,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Thank you for&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;your help&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;Works perfectly&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in my example &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;. I just did &lt;SPAN class="hps"&gt;a very small adjustment for cases when I have Needi=0 (ex. Need2=0, no amount is necessary to fill).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 11:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Create-multiple-cumulative-subtotals/m-p/117653#M32429</guid>
      <dc:creator>PC</dc:creator>
      <dc:date>2013-10-22T11:39:49Z</dc:date>
    </item>
  </channel>
</rss>

