<?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 How to create a running total in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-create-a-running-total/m-p/3020#M1361</link>
    <description>input data looks like this&lt;BR /&gt;
id    date    counts&lt;BR /&gt;
10   5/1      10&lt;BR /&gt;
10   5/2       5&lt;BR /&gt;
10  5/3        10&lt;BR /&gt;
&lt;BR /&gt;
data runningtot;&lt;BR /&gt;
  set input end = finished;&lt;BR /&gt;
totcount + count;&lt;BR /&gt;
output;&lt;BR /&gt;
if finished then do;&lt;BR /&gt;
  date = . ; &lt;BR /&gt;
  count = .;&lt;BR /&gt;
  output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
output will look like this:&lt;BR /&gt;
ID     DATE    COUNT TOTCOUNT&lt;BR /&gt;
10     5/1        10         10&lt;BR /&gt;
10     5/2          5         15&lt;BR /&gt;
10     5/3         10        25&lt;BR /&gt;
10                              25</description>
    <pubDate>Fri, 11 May 2007 00:36:47 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-05-11T00:36:47Z</dc:date>
    <item>
      <title>How to create a running total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-create-a-running-total/m-p/3020#M1361</link>
      <description>input data looks like this&lt;BR /&gt;
id    date    counts&lt;BR /&gt;
10   5/1      10&lt;BR /&gt;
10   5/2       5&lt;BR /&gt;
10  5/3        10&lt;BR /&gt;
&lt;BR /&gt;
data runningtot;&lt;BR /&gt;
  set input end = finished;&lt;BR /&gt;
totcount + count;&lt;BR /&gt;
output;&lt;BR /&gt;
if finished then do;&lt;BR /&gt;
  date = . ; &lt;BR /&gt;
  count = .;&lt;BR /&gt;
  output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
output will look like this:&lt;BR /&gt;
ID     DATE    COUNT TOTCOUNT&lt;BR /&gt;
10     5/1        10         10&lt;BR /&gt;
10     5/2          5         15&lt;BR /&gt;
10     5/3         10        25&lt;BR /&gt;
10                              25</description>
      <pubDate>Fri, 11 May 2007 00:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-create-a-running-total/m-p/3020#M1361</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-11T00:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a running total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-create-a-running-total/m-p/3021#M1362</link>
      <description>Actually, the data will look like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
    Obs    id     date    count    totcount&lt;BR /&gt;
     1     10    05/01      10        10&lt;BR /&gt;
     2     10    05/02       5        15&lt;BR /&gt;
     3     10    05/03      10        25&lt;BR /&gt;
     4     10        .       .        25&lt;BR /&gt;
[/pre]&lt;BR /&gt;
(Note missing values for OBS #4 for the Date var and the COUNT var) -- if you do a proc print on the runningtot table based on the following code:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data input;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input id date : mmddyy8. count;&lt;BR /&gt;
  return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
10 5/1/07 10&lt;BR /&gt;
10 5/2/07 5&lt;BR /&gt;
10 5/3/07 10&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
           &lt;BR /&gt;
data runningtot;&lt;BR /&gt;
set input end = finished;&lt;BR /&gt;
totcount + count;&lt;BR /&gt;
output;&lt;BR /&gt;
if finished then do;&lt;BR /&gt;
date = . ; &lt;BR /&gt;
count = .;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
                 &lt;BR /&gt;
proc print data=runningtot;&lt;BR /&gt;
  format date mmddyy5.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Not sure what your question was.&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 11 May 2007 02:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-create-a-running-total/m-p/3021#M1362</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-05-11T02:41:26Z</dc:date>
    </item>
  </channel>
</rss>

