<?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 Largest 7 day price movement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346532#M79931</link>
    <description>I have a dataset covering a year of daily data (365 rows) with two field: date and price i.e.&lt;BR /&gt;&lt;BR /&gt;Date Price&lt;BR /&gt;1/1/15. 100&lt;BR /&gt;2/1/15. 99&lt;BR /&gt;3/1/15. 101&lt;BR /&gt;4/1/15. 102&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;31/12/15 115&lt;BR /&gt;&lt;BR /&gt;I want to calculate the highest %increase over any consecutive 7 days over the 365 days. What code could I use to calculate this?</description>
    <pubDate>Sun, 02 Apr 2017 22:20:39 GMT</pubDate>
    <dc:creator>brophymj</dc:creator>
    <dc:date>2017-04-02T22:20:39Z</dc:date>
    <item>
      <title>Largest 7 day price movement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346532#M79931</link>
      <description>I have a dataset covering a year of daily data (365 rows) with two field: date and price i.e.&lt;BR /&gt;&lt;BR /&gt;Date Price&lt;BR /&gt;1/1/15. 100&lt;BR /&gt;2/1/15. 99&lt;BR /&gt;3/1/15. 101&lt;BR /&gt;4/1/15. 102&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;31/12/15 115&lt;BR /&gt;&lt;BR /&gt;I want to calculate the highest %increase over any consecutive 7 days over the 365 days. What code could I use to calculate this?</description>
      <pubDate>Sun, 02 Apr 2017 22:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346532#M79931</guid>
      <dc:creator>brophymj</dc:creator>
      <dc:date>2017-04-02T22:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Largest 7 day price movement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346534#M79932</link>
      <description>&lt;P&gt;Is this all you want?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
attrib date length=4 format=date9.;
do date = '1jan2015'd to '31dec2015'd;
   price = int(ranuni(225465114) * 30) + 95;
   output;
   end;
run;

data want;
set have;
retain max_increase 0;
max_increase = max(max_increase, price / lag6(price));
format max_increase 6.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Apr 2017 22:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346534#M79932</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2017-04-02T22:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Largest 7 day price movement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346547#M79933</link>
      <description>&lt;P&gt;Not sure if I correctly understand what you are trying to get, but I think that the following comes close:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  attrib date length=8 format=date9.;
  do date = '1jan2015'd to '31dec2015'd;
    price = int(ranuni(123) * 30) + 95;
    output;
  end;
run;

data need (keep=date pric max_increase);
  set have;
  retain stack0-stack6;
  array stack(0:6) stack0-stack6;
  stack(mod(_n_,7))=price;
  x=mod(_n_,7);
  max_increase=0;
  do i=2 to 6, 0;
    if i eq 0 then j=6;
    else j=i-1;
    max_increase=max(stack(i)/stack(j),max_increase);
  end;
run;

proc sql;
  select max(max_increase)
    from need
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 00:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Largest-7-day-price-movement/m-p/346547#M79933</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-03T00:33:48Z</dc:date>
    </item>
  </channel>
</rss>

