<?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 of row observations with different intervals in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70222#M20215</link>
    <description>this looks too much in need of the original data order to be suitable for SQL. However, the DATA STEP can easily use the ordered information:[pre]data  idx_ret_sums( keep= DATE idx_ret_sum ) ;&lt;BR /&gt;
  set pseudo_data ;&lt;BR /&gt;
  idx_ret_sum + Index ; &lt;BR /&gt;
  if not missing( returnInterval ) ;&lt;BR /&gt;
  output ;&lt;BR /&gt;
  idx_ret_sum = 0 ; * prepare accumulator for next interval;&lt;BR /&gt;
run ;&lt;BR /&gt;
 proc print ; &lt;BR /&gt;
 run;[/pre]    &lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
    <pubDate>Tue, 20 Jan 2009 09:48:33 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-01-20T09:48:33Z</dc:date>
    <item>
      <title>Sum of row observations with different intervals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70221#M20214</link>
      <description>I recently encountered the problem in a stock even study. The pseudo data looks like&lt;BR /&gt;
DATE        Index         Volume     StockReturn                 ReturnInterval&lt;BR /&gt;
19990101     0.1            200               0.02                              .&lt;BR /&gt;
19990102    0.32           300                0.03                             1&lt;BR /&gt;
19990103      0.2            0                    0                                 .&lt;BR /&gt;
19990104      0.1           200                0.04                             2                                 &lt;BR /&gt;
19990105      0.22          0                    0                                .  &lt;BR /&gt;
19990108       0.03         0                    0                                .&lt;BR /&gt;
19990109      0.2           100                 0.01                            3&lt;BR /&gt;
Here the volume 0 means on that day, the stock is not traded, but we still have the index return for the overall market. The return interval gives the number of returns between two traded dates. What I want to do is to sum of the index return over each return interval. ie: on day 19990102, the new index is itself 0.32, on day 19990104, the new index return should be 0.2+0.1, and on day 19990109, the new index return should be 0.22+0.03+0.2.&lt;BR /&gt;
&lt;BR /&gt;
I hope any ppl can help me with this.. Heaps Thanks here first.</description>
      <pubDate>Tue, 20 Jan 2009 08:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70221#M20214</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-01-20T08:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of row observations with different intervals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70222#M20215</link>
      <description>this looks too much in need of the original data order to be suitable for SQL. However, the DATA STEP can easily use the ordered information:[pre]data  idx_ret_sums( keep= DATE idx_ret_sum ) ;&lt;BR /&gt;
  set pseudo_data ;&lt;BR /&gt;
  idx_ret_sum + Index ; &lt;BR /&gt;
  if not missing( returnInterval ) ;&lt;BR /&gt;
  output ;&lt;BR /&gt;
  idx_ret_sum = 0 ; * prepare accumulator for next interval;&lt;BR /&gt;
run ;&lt;BR /&gt;
 proc print ; &lt;BR /&gt;
 run;[/pre]    &lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 20 Jan 2009 09:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70222#M20215</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-20T09:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of row observations with different intervals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70223#M20216</link>
      <description>Hi Peter, Thanks so much.. I will test on my whole data soon, but i am sure it gonna work well.</description>
      <pubDate>Tue, 20 Jan 2009 10:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-of-row-observations-with-different-intervals/m-p/70223#M20216</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-01-20T10:56:29Z</dc:date>
    </item>
  </channel>
</rss>

