<?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 get the variable that is based on cumulative sum of pervious rows and current row? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40843#M8355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;input m;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t2;&lt;/P&gt;&lt;P&gt;set t;&lt;/P&gt;&lt;P&gt;k=m+;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want result like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;m k&lt;/P&gt;&lt;P&gt;5&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;4&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;11 20&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 29 Jan 2012 16:42:39 GMT</pubDate>
    <dc:creator>ZRick</dc:creator>
    <dc:date>2012-01-29T16:42:39Z</dc:date>
    <item>
      <title>how to get the variable that is based on cumulative sum of pervious rows and current row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40843#M8355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;input m;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t2;&lt;/P&gt;&lt;P&gt;set t;&lt;/P&gt;&lt;P&gt;k=m+;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want result like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;m k&lt;/P&gt;&lt;P&gt;5&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;4&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;11 20&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jan 2012 16:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40843#M8355</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-01-29T16:42:39Z</dc:date>
    </item>
    <item>
      <title>how to get the variable that is based on cumulative sum of pervious rows and current row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40844#M8356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;input m;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set t;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain k;&lt;/P&gt;&lt;P&gt;&amp;nbsp; k+m;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt; proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jan 2012 17:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40844#M8356</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-01-29T17:23:17Z</dc:date>
    </item>
    <item>
      <title>how to get the variable that is based on cumulative sum of pervious rows and current row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40845#M8357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the purpose of retain statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is K initially assume as zero? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should I do following if I want to initial k value other than zero? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set t;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k=2.4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain k;&lt;/P&gt;&lt;P&gt;&amp;nbsp; k+m;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jan 2012 18:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40845#M8357</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-01-29T18:57:44Z</dc:date>
    </item>
    <item>
      <title>how to get the variable that is based on cumulative sum of pervious rows and current row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40846#M8358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... if you don't want to set an initial value, you can skip the RETAIN statement since a SUM statement (K+M) implies retain and starts with an initial value of 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to set an initial value ... RETAIN K 2.4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289454.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289454.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jan 2012 19:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-variable-that-is-based-on-cumulative-sum-of/m-p/40846#M8358</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-01-29T19:39:29Z</dc:date>
    </item>
  </channel>
</rss>

