<?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: PROC SQL code to calculate accumalte data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750557#M236109</link>
    <description>&lt;P&gt;So as I understand the answer is :&lt;/P&gt;
&lt;P&gt;Let's think that this is table B and A&lt;/P&gt;
&lt;P&gt;obs value&lt;BR /&gt;1 1&lt;BR /&gt;2 2&lt;BR /&gt;3 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to first obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=1)&lt;/P&gt;
&lt;P&gt;so only the first obs selected ,and sum(1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to 2nd obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=2)&lt;/P&gt;
&lt;P&gt;so only the first TWO obs selected ,and sum(1,2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to 3&lt;SUP&gt;rd&lt;/SUP&gt; &amp;nbsp;obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=3)&lt;/P&gt;
&lt;P&gt;so only the first THREE obs selected ,and sum(1,2,3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;........and so on&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jun 2021 21:41:47 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2021-06-25T21:41:47Z</dc:date>
    <item>
      <title>PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749706#M235658</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;May anyone explain the PROC SQL code to calculate accumalte data.&lt;/P&gt;
&lt;P&gt;May expplain the order of execuations here&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ronein_0-1624392950620.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60635i72B6475CF49BDBC7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ronein_0-1624392950620.png" alt="Ronein_0-1624392950620.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 20:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749706#M235658</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-06-22T20:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749709#M235660</link>
      <description>Google CROSS JOIN.</description>
      <pubDate>Tue, 22 Jun 2021 20:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749709#M235660</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-22T20:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749737#M235674</link>
      <description>&lt;P&gt;I don't really like SQL for a running total. I think it is better to use a data step or proc summary. Did you get this from a SAS paper?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 21:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749737#M235674</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-22T21:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749841#M235730</link>
      <description>Assuming you have data like :&lt;BR /&gt;&lt;BR /&gt;obs  value&lt;BR /&gt;1  1&lt;BR /&gt;2  2&lt;BR /&gt;3  3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So SQL could get this:&lt;BR /&gt;obs  value    cumulative&lt;BR /&gt;1  1              1         &amp;lt;--  due to this.obs&amp;lt;=b.obs(=1)&lt;BR /&gt;2  2               1+2    &amp;lt;--  due to this.obs&amp;lt;=b.obs(=2)&lt;BR /&gt;3  3               1+2+3    &amp;lt;--  due to this.obs&amp;lt;=b.obs(=3)&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jun 2021 12:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/749841#M235730</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-23T12:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750212#M235919</link>
      <description>&lt;P&gt;My question was different:&lt;/P&gt;
&lt;P&gt;I wanted to understand how SAS process this sql query.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;SAS read data set "Shoes" and call it&amp;nbsp; "b"&lt;/P&gt;
&lt;P&gt;Then SAS read data set "Shoes" again and call it "a"&lt;/P&gt;
&lt;P&gt;Then for each row SAS accumulate total of sales from first observation till current observation (included) .(Techincally it is a.obs&amp;lt;=b.obs)&lt;/P&gt;
&lt;P&gt;Then SAS select the columns region ,product ,sales from b and select total sales&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it true??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 14:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750212#M235919</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-06-24T14:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750423#M236047</link>
      <description>&lt;P&gt;This is table B&lt;BR /&gt;obs value&lt;BR /&gt;1 1&lt;BR /&gt;2 2&lt;BR /&gt;3 3&lt;BR /&gt;&lt;BR /&gt;For the first obs of B&lt;BR /&gt;1 1 &amp;lt;-- sql select the obs from table A where a.obs&amp;lt;=b.obs(=1) ,so only the first obs selected ,and sum(1)&lt;BR /&gt;&lt;BR /&gt;For the second obs of B&lt;BR /&gt;2 2 &amp;lt;-- sql select the obs from table A where a.obs&amp;lt;=b.obs(=2) ,so only the first TWO obs selected ,and sum(1,2)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For the third obs of B&lt;BR /&gt;3 3 &amp;lt;-- sql select the obs from table A where a.obs&amp;lt;=b.obs(=3) ,so only the first THREE obs selected ,and sum(1,2,3)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;........and so on .&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 10:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750423#M236047</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-26T10:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750556#M236108</link>
      <description>Perfect but just need to change to &amp;lt;= instaed of &amp;lt;&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Jun 2021 21:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750556#M236108</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-06-25T21:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL code to calculate accumalte data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750557#M236109</link>
      <description>&lt;P&gt;So as I understand the answer is :&lt;/P&gt;
&lt;P&gt;Let's think that this is table B and A&lt;/P&gt;
&lt;P&gt;obs value&lt;BR /&gt;1 1&lt;BR /&gt;2 2&lt;BR /&gt;3 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to first obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=1)&lt;/P&gt;
&lt;P&gt;so only the first obs selected ,and sum(1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to 2nd obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=2)&lt;/P&gt;
&lt;P&gt;so only the first TWO obs selected ,and sum(1,2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go to 3&lt;SUP&gt;rd&lt;/SUP&gt; &amp;nbsp;obs in table B&lt;/P&gt;
&lt;P&gt;then select the obs from table A where a.obs&amp;lt;=b.obs(=3)&lt;/P&gt;
&lt;P&gt;so only the first THREE obs selected ,and sum(1,2,3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;........and so on&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 21:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-code-to-calculate-accumalte-data/m-p/750557#M236109</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-06-25T21:41:47Z</dc:date>
    </item>
  </channel>
</rss>

