<?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: 52 week high - problem with stocks where high does not change in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214489#M39576</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;looks like you need to reset day when price=high or new high or start of new year? try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; infile cards truncover expandtabs;&lt;BR /&gt; input Ticker date date9. Price High;&lt;BR /&gt; cards;&lt;BR /&gt;33 07-Dec-00 0.09 0.12&lt;BR /&gt;33 11-Dec-00 0.09 0.12&lt;BR /&gt;33 13-Dec-00 0.09 0.12&lt;BR /&gt;33 15-Dec-00 0.09 0.12&lt;BR /&gt;33 18-Dec-00 0.08 0.12&lt;BR /&gt;33 20-Dec-00 0.09 0.11&lt;BR /&gt;33 21-Dec-00 0.08 0.11&lt;BR /&gt;33 27-Dec-00 0.08 0.11&lt;BR /&gt;33 28-Dec-00 0.08 0.11&lt;BR /&gt;33 29-Dec-00 0.09 0.11&lt;BR /&gt;33 03-Jan-01 0.08 0.11&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; set have;&lt;BR /&gt; year=year(date);&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt;proc sort data=have;&lt;BR /&gt; by ticker year date ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; by ticker year date;&lt;BR /&gt; _high=lag(high);&lt;BR /&gt; _date=lag(date);&lt;BR /&gt; retain days_since_last_high;&lt;BR /&gt; if first.ticker then do; _high=.; _date=.; end;&lt;BR /&gt; if first.ticker or first.year or price=high or high^=_high then days_since_last_high=1; *** reset to day 1;&lt;BR /&gt; else days_since_last_high=days_since_last_high+date-_date;&lt;BR /&gt; format date _date date9.;&lt;BR /&gt; drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jul 2015 18:52:37 GMT</pubDate>
    <dc:creator>ndp</dc:creator>
    <dc:date>2015-07-28T18:52:37Z</dc:date>
    <item>
      <title>52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214477#M39564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;We have a problem with 52 week high data. We calculated 52 week highs - this is fine.&lt;/P&gt;&lt;P&gt;However we also want to calculate the number of days since the 52 week high.&lt;/P&gt;&lt;P&gt;The following code seemed to work fine and was provided from a forum member called null:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data dayssince;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set 52weekhigh;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by Ticker High NOTSORTED;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.high then daysince=0; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else daysince+1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When applied to the following data we get:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="340"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;Ticker&lt;/TD&gt;&lt;TD width="88"&gt;Price&lt;/TD&gt;&lt;TD width="86"&gt;High&lt;/TD&gt;&lt;TD width="102"&gt;days_since&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.07&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.05&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.07&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.06&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that we want the clock to "reset" every time it reverts back to a new high, even though the high has not changed.&lt;/P&gt;&lt;P&gt;In other words, we need to start the clock from the last time the high was hit.&lt;/P&gt;&lt;P&gt;The result should look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 340px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;Ticker&lt;/TD&gt;&lt;TD width="88"&gt;Price&lt;/TD&gt;&lt;TD width="86"&gt;High&lt;/TD&gt;&lt;TD width="102"&gt;days_since&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.07&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.05&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.07&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.06&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any direction would be greatly assisted!&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 05:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214477#M39564</guid>
      <dc:creator>merton76</dc:creator>
      <dc:date>2015-06-26T05:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214478#M39565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mean John King ?&amp;nbsp; He is the best SAS Programmer in the world .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3 style="color: #353535; font-family: Lato, sans-serif; background-color: #f0f1f2;"&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;infile&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;expandtabs&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Ticker&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Price&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;High&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.09 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.08 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.09 0.09&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.09 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.07 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.05 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.09 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.08 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.07 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.06 0.09 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.08 0.09&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 0.09 0.09&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;temp&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Ticker&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;first.Ticker&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;or&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Price&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;High&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;temp&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;first.n&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;days_since&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;days_since&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;drop&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 13:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214478#M39565</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-26T13:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214479#M39566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you want to set days_since to zero each time Price = High? Maybe i am unable to get the complexity of the problem, time of day and temperature may count as valid excuses, but it could be as simple as changing the if-statement to &lt;/P&gt;&lt;P&gt;if price = high then days_since = 0;&lt;/P&gt;&lt;P&gt;else days_since+1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 15:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214479#M39566</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2015-06-26T15:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214480#M39567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much xia keshan. There is one more wrinkle we have to deal with. We want the clock to start ticking (i.e. "n" to change) when there is &lt;EM&gt;either&lt;/EM&gt; a new high or high = price&lt;/P&gt;&lt;P&gt;The problem arises when we get a new high because one year has elapsed. &lt;/P&gt;&lt;P&gt;The problem only occurs when one year has elapsed and the price declines, as follows:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="1072"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="72"&gt;Ticker&lt;/TD&gt;&lt;TD width="72"&gt;Date&lt;/TD&gt;&lt;TD width="72"&gt;Price&lt;/TD&gt;&lt;TD width="72"&gt;High&lt;/TD&gt;&lt;TD width="72"&gt;n&lt;/TD&gt;&lt;TD width="72"&gt;days_since&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;7-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;242&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;8-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;243&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;11-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;244&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;12-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;245&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;13-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;246&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;14-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;247&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;15-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;248&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;18-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;249&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;19-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.12&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;20-Dec-00&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;0.09&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;0.11&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;79883&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;251&lt;/TD&gt;&lt;TD class="xl66" colspan="10"&gt;n should change here because the high has changed. However n is only changing when High = Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;21-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;252&lt;/TD&gt;&lt;TD class="xl67" colspan="6"&gt;Note: 251 days is the 52 week cut off (one trading year)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;22-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;253&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;25-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;254&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;26-Dec-00&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;255&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;27-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;256&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;28-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;257&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;29-Dec-00&lt;/TD&gt;&lt;TD align="right"&gt;0.09&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;258&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;1-Jan-01&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;259&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;2-Jan-01&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;260&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;33&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;3-Jan-01&lt;/TD&gt;&lt;TD align="right"&gt;0.08&lt;/TD&gt;&lt;TD align="right"&gt;0.11&lt;/TD&gt;&lt;TD align="right"&gt;79883&lt;/TD&gt;&lt;TD align="right"&gt;261&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have spent have few hours trying to work this out, well at least I'm learning...&lt;/P&gt;&lt;P&gt;Many Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 02:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214480#M39567</guid>
      <dc:creator>merton76</dc:creator>
      <dc:date>2015-06-30T02:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214481#M39568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change it &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt; set have;&lt;/P&gt;&lt;P&gt; by Ticker ;&lt;/P&gt;&lt;P&gt; if first.Ticker or Price=High &lt;STRONG&gt;or High ne lag(High)&lt;/STRONG&gt; then n+1;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 12:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214481#M39568</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-30T12:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214482#M39569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again xia keshan&lt;/P&gt;&lt;P&gt;There is still a problem. The best way to explain is in words.&lt;/P&gt;&lt;P&gt;Assume that we are at 1 January 2007 and the stock price is $1&lt;/P&gt;&lt;P&gt;The stock price goes down the next day to $0.80 and stays at that level&lt;/P&gt;&lt;P&gt;On 1 July 2007 the stock price rises for one day, but only to $0.90&lt;/P&gt;&lt;P&gt;On 1 July 2008 the stock price is $0.85. At this point, according to the code as it exists, the days since the 365 day high is 0 days. However it is, in fact, 182 days since the previous high&lt;/P&gt;&lt;P&gt;The challenge is creating code that can address&lt;/P&gt;&lt;P&gt;My thought was that we need another "n", call it "n2" that tracks the high over the previous 365 days. The solution is then the maximum of our existing n and n2.&lt;/P&gt;&lt;P&gt;I think this may work...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 06:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214482#M39569</guid>
      <dc:creator>merton76</dc:creator>
      <dc:date>2015-07-02T06:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214483#M39570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry . I can't understand you .&lt;/P&gt;&lt;P&gt;As far as I can see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data temp;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set have;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;by Ticker ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if first.Ticker or Price=High &lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;or ( High ne lag(High)&lt;/STRONG&gt;&amp;nbsp; and price ne lag(price) ) then n+1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 12:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214483#M39570</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-02T12:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214484#M39571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Xia, it is difficult to explain.&lt;/P&gt;&lt;P&gt;Essentially we need to search for the last high over the previous 365 days, then count the number of days since that high&lt;/P&gt;&lt;P&gt;We also need to deal with situations where the high is the same on multiple days over the last 365 days. In this case we need the most recent date&lt;/P&gt;&lt;P&gt;Thanks so very much for being patient with me, really appreciate it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 00:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214484#M39571</guid>
      <dc:creator>merton76</dc:creator>
      <dc:date>2015-07-03T00:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214485#M39572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry. You'd better start a new session and give a good example to explain it and let more people to see it .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2015 12:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214485#M39572</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-03T12:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214486#M39573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="color: navy; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; PRICES;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; DATE=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;'01jan2010'd&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;'31dec2011'd&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICE=ranuni(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; DATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; background: none repeat scroll 0% 0% white;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="color: navy; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="color: navy; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; HIGHS_12M;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; DATES&amp;nbsp; [&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;730&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; PRICES [&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;730&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; OBS_DAY=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;730&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* load data in arrays;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; PRICES;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATES [OBS_DAY]=DATE ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white; font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICES[OBS_DAY]=PRICE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; OBS_DAY=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;730&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* for each observation date;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; LOOKUP_DAY=max(OBS_DAY-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;365&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: none repeat scroll 0% 0% white; font-size: 10pt;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; OBS_DAY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* look in last 365 days&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXPRICE=max(MAXPRICE,PRICES[LOOKUP_DAY]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* find max price&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; MAXPRICE=PRICES[LOOKUP_DAY] &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;then&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXDATE=DATES[LOOKUP_DAY];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* store matching date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE=DATES[OBS_DAY];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* save data for day&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; missing(MAXPRICE,MAXDATE);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: green; background: none repeat scroll 0% 0% white;"&gt;* reset for next obs day&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; DATE MAXDATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; background: none repeat scroll 0% 0% white;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt; DATE MAX:;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;SPAN style="font-size: 10pt; color: blue; background: none repeat scroll 0% 0% white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 11:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214486#M39573</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-07-08T11:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214487#M39574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chris, do you know how we would do this by ticker?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 07:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214487#M39574</guid>
      <dc:creator>merton76</dc:creator>
      <dc:date>2015-07-09T07:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214488#M39575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV class="message content" id="msg-preview"&gt;Like this?&lt;BR /&gt;&lt;DIV class="y-module message-header base-header " id="yui_3_16_0_1_1433930387091_48373"&gt;&lt;DIV class="base-card-header" id="yui_3_16_0_1_1433930387091_48464"&gt;&lt;DIV class="message-item-header" id="yui_3_16_0_1_1433930387091_48463"&gt;&lt;DIV class="contents" id="yui_3_16_0_1_1433930387091_48462"&gt;&lt;DL class="details"&gt;&lt;DD class="hide-dd"&gt;&amp;nbsp; &lt;/DD&gt;&lt;/DL&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P class="base-card-body" id="yui_3_16_0_1_1433930387091_48467"&gt;&lt;/P&gt;&lt;DIV class="msg-body inner  undoreset" id="yui_3_16_0_1_1433930387091_48470"&gt;&lt;DIV class="email-wrapped" id="yui_3_16_0_1_1433930387091_48469"&gt;&lt;DIV id="yiv1909643333"&gt;&lt;SPAN style="color: #000080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; PRICES;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; TICKER =&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; DATE=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;'01jan2010'd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;'31dec2011'd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICE=ranuni(&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; DATE &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="color: #000080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #000080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; HIGHS_12M;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; DATES&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;730&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; PRICES [&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;730&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; DAY=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;(last.TICKER);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* load 1 ticker in arrays&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DAY+&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; PRICES;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; TICKER &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;notsorted&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATES [DAY]=DATE ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICES[DAY]=PRICE;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; OBS_DAY=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; DAY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* for each observation date;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; LOOKUP_DAY=max(OBS_DAY-&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;365&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; OBS_DAY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* scan last 365 days&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXPRICE=max(MAXPRICE,PRICES[LOOKUP_DAY]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* find max price&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; MAXPRICE=PRICES[LOOKUP_DAY] &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAXDATE=DATES[LOOKUP_DAY];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* store matching date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE=DATES[OBS_DAY];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* save data for day&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; missing(MAXPRICE,MAXDATE);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;* reset for next obs day&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; DATE MAXDATE &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; TICKER DATE MAX:;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN style="color: #000080; font-family: Courier New; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 08:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214488#M39575</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-07-10T08:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214489#M39576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;looks like you need to reset day when price=high or new high or start of new year? try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; infile cards truncover expandtabs;&lt;BR /&gt; input Ticker date date9. Price High;&lt;BR /&gt; cards;&lt;BR /&gt;33 07-Dec-00 0.09 0.12&lt;BR /&gt;33 11-Dec-00 0.09 0.12&lt;BR /&gt;33 13-Dec-00 0.09 0.12&lt;BR /&gt;33 15-Dec-00 0.09 0.12&lt;BR /&gt;33 18-Dec-00 0.08 0.12&lt;BR /&gt;33 20-Dec-00 0.09 0.11&lt;BR /&gt;33 21-Dec-00 0.08 0.11&lt;BR /&gt;33 27-Dec-00 0.08 0.11&lt;BR /&gt;33 28-Dec-00 0.08 0.11&lt;BR /&gt;33 29-Dec-00 0.09 0.11&lt;BR /&gt;33 03-Jan-01 0.08 0.11&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; set have;&lt;BR /&gt; year=year(date);&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt;proc sort data=have;&lt;BR /&gt; by ticker year date ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; by ticker year date;&lt;BR /&gt; _high=lag(high);&lt;BR /&gt; _date=lag(date);&lt;BR /&gt; retain days_since_last_high;&lt;BR /&gt; if first.ticker then do; _high=.; _date=.; end;&lt;BR /&gt; if first.ticker or first.year or price=high or high^=_high then days_since_last_high=1; *** reset to day 1;&lt;BR /&gt; else days_since_last_high=days_since_last_high+date-_date;&lt;BR /&gt; format date _date date9.;&lt;BR /&gt; drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 18:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/214489#M39576</guid>
      <dc:creator>ndp</dc:creator>
      <dc:date>2015-07-28T18:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/247903#M46513</link>
      <description>&lt;P&gt;What an elegant solution to a non-trivial problem, many have tried and failed.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 05:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/247903#M46513</guid>
      <dc:creator>PJDub</dc:creator>
      <dc:date>2016-02-04T05:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: 52 week high - problem with stocks where high does not change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/252661#M47999</link>
      <description>&lt;P&gt;Thank you! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 06:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/52-week-high-problem-with-stocks-where-high-does-not-change/m-p/252661#M47999</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-02-26T06:27:41Z</dc:date>
    </item>
  </channel>
</rss>

