<?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: How to reverse the cumulative sum across the rows? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636738#M189207</link>
    <description>Look up the DIF() function.</description>
    <pubDate>Thu, 02 Apr 2020 01:27:50 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-04-02T01:27:50Z</dc:date>
    <item>
      <title>How to reverse the cumulative sum across the rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636731#M189203</link>
      <description>&lt;P&gt;Hi Folks:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have variables 'test' and 'negative' which are cumulatively added across rows. Could you please help me reverse the cumulative process? I'd like to have numbers for each row without encompassing the value in the preceding rows. I need the first 3 rows of 'test' variable 1,0,3 instead 1,1,4 before it's turned into cumulative sum across the rows?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time in advance.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
length date $10.; 
input date $ test negative;
cards;
1/20/2020	1	0
1/21/2020	1	0
1/22/2020	4	3
1/23/2020	22	21
1/24/2020	27	25
1/25/2020	27	25
1/26/2020	51	47
1/27/2020	61	56
1/28/2020	116	97
1/29/2020	187	155
1/30/2020	246	199
1/31/2020	312	245
2/1/2020	371	289
2/2/2020	429	327
2/3/2020	490	414
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;ac&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 00:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636731#M189203</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-04-02T00:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse the cumulative sum across the rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636738#M189207</link>
      <description>Look up the DIF() function.</description>
      <pubDate>Thu, 02 Apr 2020 01:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636738#M189207</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-02T01:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse the cumulative sum across the rows?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636744#M189210</link>
      <description>&lt;P&gt;Using DIF, and taking care of the first row:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
set have;
dtest = coalesce(dif(test), test);
dneg = coalesce(dif(negative), negative);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2020 02:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-reverse-the-cumulative-sum-across-the-rows/m-p/636744#M189210</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-04-02T02:16:22Z</dc:date>
    </item>
  </channel>
</rss>

