<?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: Runnung Total in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635153#M188560</link>
    <description>It looks like you're doing summaries at different levels? PROC MEANS does this automatically as long as you specify your TYPES/WAYS correctly. I would recommend looking into that option instead.</description>
    <pubDate>Thu, 26 Mar 2020 21:40:45 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-03-26T21:40:45Z</dc:date>
    <item>
      <title>Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635148#M188558</link>
      <description>&lt;P&gt;Hi....I having problem getting the output I want when it comes to calculating "Total". I would like to only sum up the "ShowAmount" if the "Start" date is missing. Any suggestions.....Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
    length ID 8 TransDate $ 8 ShowAmount 8 Date $ 8 start $ 8 end $ 8;
    format ID best12. TransDate $char8. ShowAmount DOLLAR20.2 Date $char8. start $char8. end $char8.;
	infile datalines4 dlm='7F'x missover dsd;
    input ID : best32. TransDate : $char8. ShowAmount : best32. Date : $char8. start : $char8. end : $char8. ;
datalines4;
152&amp;#127;20000720&amp;#127;1550&amp;#127;20000720 
152&amp;#127;20000804&amp;#127;1550&amp;#127;20000804 
152&amp;#127;20140807&amp;#127;450&amp;#127;20140807
152&amp;#127;20140827&amp;#127;100&amp;#127;20140827 
152&amp;#127; &amp;#127;.&amp;#127;20140903&amp;#127;20140903&amp;#127;20140930
152&amp;#127; &amp;#127;.&amp;#127;20141001&amp;#127;20141001&amp;#127;20141008
152&amp;#127;20150827&amp;#127;450&amp;#127;20150827&amp;#127; &amp;#127; 
152&amp;#127; &amp;#127;.&amp;#127;20150917&amp;#127;20150917&amp;#127;20150930
152&amp;#127; &amp;#127;.&amp;#127;20151001&amp;#127;20151001&amp;#127;20151031
152&amp;#127;20151111&amp;#127;700&amp;#127;20151111&amp;#127;20151101&amp;#127;20151130
152&amp;#127; &amp;#127;.&amp;#127;20151201&amp;#127;20151201&amp;#127;20151210
152&amp;#127;20160108&amp;#127;550&amp;#127;20160108&amp;#127; &amp;#127; 
152&amp;#127; &amp;#127;.&amp;#127;20160113&amp;#127;20160113&amp;#127;20160131
152&amp;#127;20160229&amp;#127;450&amp;#127;20160229&amp;#127;20160201&amp;#127;20160229
152&amp;#127; &amp;#127;.&amp;#127;20160301&amp;#127;20160301&amp;#127;20160323
152&amp;#127; &amp;#127;.&amp;#127;20160406&amp;#127;20160406&amp;#127;20160430
152&amp;#127; &amp;#127;.&amp;#127;20160501&amp;#127;20160501&amp;#127;20160531
152&amp;#127; &amp;#127;.&amp;#127;20160601&amp;#127;20160601&amp;#127;20160629
;;;;

data want;
	set have;
	by ID TransDate notsorted;
		if first.ID then 
			Total = 0;
			Total + ShowAmount;
		if not missing(Start) then 
			Output;
run;


Want:
ID	TransDate	ShowAmount	Date	start	end	Total
152			20140903	20140903	20140930	3650
152			20141001	20141001	20141008	3650
152			20150917	20150917	20150930	4100
152			20151001	20151001	20151031	4100
152	20151111	$700.00	20151111	20151101	20151130	4800
152			20151201	20151201	20151210	4800
152			20160113	20160113	20160131	4650
152	20160229	$450.00	20160229	20160201	20160229	4650
152			20160301	20160301	20160323	4650
152			20160406	20160406	20160430	4650
152			20160501	20160501	20160531	4650
152			20160601	20160601	20160629	4650

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Mar 2020 03:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635148#M188558</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2020-03-27T03:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Runnung Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635153#M188560</link>
      <description>It looks like you're doing summaries at different levels? PROC MEANS does this automatically as long as you specify your TYPES/WAYS correctly. I would recommend looking into that option instead.</description>
      <pubDate>Thu, 26 Mar 2020 21:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635153#M188560</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-26T21:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635185#M188578</link>
      <description>&lt;P&gt;Changed thread title from "Runnung Total" to "Running Total"&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 03:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Running-Total/m-p/635185#M188578</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-03-27T03:45:55Z</dc:date>
    </item>
  </channel>
</rss>

