<?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: Sum statement (not sum function) question? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183454#M46693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Miris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;LOAN_RECEIVER + 1;&lt;/STRONG&gt; statement is just equivalent to &lt;STRONG&gt;LOAN_RECEIVER = LOAN_RECEIVER + 1;&lt;/STRONG&gt;, &lt;SPAN style="text-decoration: underline;"&gt;except&lt;/SPAN&gt; for two side effects that are implied by &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; being the target of the sum statement. First, &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; value is RETAINed from one iteration to the next, second, &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; is initialized with zero. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you see, the statement &lt;STRONG&gt;RETAIN LOAN_RECEIVER 0;&lt;/STRONG&gt; is not needed at all, as both statement's effects are already implied. Try removing it. you should see no change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 23 Feb 2014 19:42:57 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2014-02-23T19:42:57Z</dc:date>
    <item>
      <title>Sum statement (not sum function) question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183452#M46691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Hi Forum,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Could anyone help me to undestand the red colored piece of this code?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;/*&lt;SPAN style="color: #00ff00;"&gt;&lt;SPAN style="color: #008000;"&gt;Sorting in preparation for "By-group processing"&lt;/SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN style="color: #339966;"&gt;I understand this&amp;nbsp; &lt;/SPAN&gt; */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;SORT&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;DATA&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=A; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; ID_NUM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*By-group processing- I understand this&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;DATA&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; A1 A2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; A&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;BY&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; ID_NUM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;RETAIN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; LOAN_RECEIVER &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000;"&gt;LOAN_RECEIVER + &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background: white; font-size: 11pt; font-family: 'Courier New';"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Sum statement (not sum function) which returns accumulated total, am I correct?&lt;/STRONG&gt;*/&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; FIRST.ID_NUM &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; LOAN_RECEIVER = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; LOAN_RECEIVER = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;THEN&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;OUTPUT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; A1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;ELSE&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; LOAN_RECEIVER = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;THEN&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;OUTPUT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; A2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Q:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;LOAN_RECEIVER + &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background: white; font-size: 11pt; font-family: 'Courier New';"&gt;; is the &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Sum statement (not sum function) which returns accumulated total, am I correct?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Miris&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Feb 2014 19:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183452#M46691</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2014-02-23T19:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sum statement (not sum function) question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183453#M46692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you are correct.The retain statement is unnecessary since variables in a sum statement are retained by default. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Feb 2014 19:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183453#M46692</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-02-23T19:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sum statement (not sum function) question?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183454#M46693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Miris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;LOAN_RECEIVER + 1;&lt;/STRONG&gt; statement is just equivalent to &lt;STRONG&gt;LOAN_RECEIVER = LOAN_RECEIVER + 1;&lt;/STRONG&gt;, &lt;SPAN style="text-decoration: underline;"&gt;except&lt;/SPAN&gt; for two side effects that are implied by &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; being the target of the sum statement. First, &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; value is RETAINed from one iteration to the next, second, &lt;STRONG&gt;LOAN_RECEIVER&lt;/STRONG&gt; is initialized with zero. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you see, the statement &lt;STRONG&gt;RETAIN LOAN_RECEIVER 0;&lt;/STRONG&gt; is not needed at all, as both statement's effects are already implied. Try removing it. you should see no change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Feb 2014 19:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-statement-not-sum-function-question/m-p/183454#M46693</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-23T19:42:57Z</dc:date>
    </item>
  </channel>
</rss>

