<?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: Accumulated Value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909700#M358796</link>
    <description>&lt;P&gt;If you want to calculate a running sum just use a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1dfiqj146yi2cn1maeju9wo7ijs.htm" target="_self"&gt;SUM STATEMENT&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;There is no need to jumps throw hoops to try an impose sequential data processing on SQL's normal set based processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PARETO ;
  set CLSD_01;
  where PERIODO = 202311;
  acumulado + MRG_SR;
  keep CD_CLI MRG_SR acumulado ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to generate separate accumulations per group then use BY group processing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PARETO ;
  set CLSD_01;
  by PERIODO CD_CLI ;
  if first.PERIODO then acumulado=0;
  acumulado + MRG_SR;
  keep PERIODO CD_CLI MRG_SR acumulado ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 19:23:00 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-12-26T19:23:00Z</dc:date>
    <item>
      <title>Accumulated Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909695#M358793</link>
      <description>Please people, a little help here.&lt;BR /&gt;&lt;BR /&gt;I would like to calculate the accumulated value, but when I use the formula below the following error appears:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.PARETO AS&lt;BR /&gt;SELECT&lt;BR /&gt;T1.CD_CLI,&lt;BR /&gt;T1.MRG_SR,&lt;BR /&gt;Sum(T1.MRG_SR) OVER (ORDER BY T1.PERIODO ROWS&lt;BR /&gt;BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS 'acumulado'&lt;BR /&gt;FROM CLSD_01 T1&lt;BR /&gt;WHERE T1.PERIODO = 202311&lt;BR /&gt;;QUIT;&lt;BR /&gt;&lt;BR /&gt;____&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;BR /&gt;CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Dec 2023 17:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909695#M358793</guid>
      <dc:creator>Demarchi83</dc:creator>
      <dc:date>2023-12-26T17:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulated Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909699#M358795</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/460199"&gt;@Demarchi83&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Proc SQL which I think is based on &lt;A href="https://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p0corah7t43hy7n1r7efplde5c8z.htm" target="_blank" rel="noopener"&gt;SQL 1992 standards&lt;/A&gt; does not support SQL windowing analytical functions.&lt;/P&gt;
&lt;P&gt;You alternatives are :&lt;BR /&gt;&amp;nbsp;- Data Step with the DOW loop --- Fully Customizable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Proc Report ---&amp;nbsp;Fully Customizable&lt;BR /&gt;&amp;nbsp;- Proc Freq&amp;nbsp; --- Limited Customizable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Proc summary/means --- Limited Customizable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 18:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909699#M358795</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-12-26T18:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulated Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909700#M358796</link>
      <description>&lt;P&gt;If you want to calculate a running sum just use a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1dfiqj146yi2cn1maeju9wo7ijs.htm" target="_self"&gt;SUM STATEMENT&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;There is no need to jumps throw hoops to try an impose sequential data processing on SQL's normal set based processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PARETO ;
  set CLSD_01;
  where PERIODO = 202311;
  acumulado + MRG_SR;
  keep CD_CLI MRG_SR acumulado ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to generate separate accumulations per group then use BY group processing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PARETO ;
  set CLSD_01;
  by PERIODO CD_CLI ;
  if first.PERIODO then acumulado=0;
  acumulado + MRG_SR;
  keep PERIODO CD_CLI MRG_SR acumulado ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 19:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909700#M358796</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-26T19:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulated Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909710#M358804</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13868"&gt;@AhmedAl_Attar&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;SAS Proc SQL which I think is based on &lt;A href="https://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p0corah7t43hy7n1r7efplde5c8z.htm" target="_blank" rel="noopener"&gt;SQL 1992 standards&lt;/A&gt; does not support SQL windowing analytical functions.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;PROC SQL :&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;SAS Viya 4 SQL Procedure User’s Guide&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;PROC SQL and the ANSI Standard&lt;BR /&gt;ANSI =&amp;nbsp;&lt;SPAN&gt;The American National Standards Institute&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_046/sqlproc/p0corah7t43hy7n1r7efplde5c8z.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_046/sqlproc/p0corah7t43hy7n1r7efplde5c8z.htm&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Differences in PROC SQL and ANSI SQL&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_046/sqlproc/p0corah7t43hy7n1r7efplde5c8z.htm#p0beovds26sevpn1ti8o20dulkp2" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_046/sqlproc/p0corah7t43hy7n1r7efplde5c8z.htm#p0beovds26sevpn1ti8o20dulkp2&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;PROC FEDSQL :&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The FedSQL language (PROC FEDSQL) is the SAS implementation of the ANSI SQL:1999 core standard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Koen&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 21:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909710#M358804</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-12-26T21:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Accumulated Value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909711#M358805</link>
      <description>&lt;P&gt;Home &amp;gt; Learn SAS &amp;gt; New Users &amp;gt; &lt;BR /&gt;culmulative sum by group using Proc SQL&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/culmulative-sum-by-group-using-Proc-SQL/td-p/517593" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/culmulative-sum-by-group-using-Proc-SQL/td-p/517593&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Home &amp;gt; Programming &amp;gt; Programming &amp;gt; &lt;BR /&gt;Cumulative total using proc sql&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Cumulative-total-using-proc-sql/td-p/614451" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Cumulative-total-using-proc-sql/td-p/614451&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 21:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accumulated-Value/m-p/909711#M358805</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-12-26T21:10:15Z</dc:date>
    </item>
  </channel>
</rss>

