<?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 LIFO logic for calculating return from shares held in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213174#M39381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings for the day...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, I want to pair my Sell transactions with Buy transactions considering LIFO logic. This means, whenever I sell shares I want to know its corresponding BUY, who were last bought prior to my Sell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, On 1 st of July, I bought 100, and 25 shares, and sold all 125 shares, So prior to selling 125 shares, my last bought 125 shares were also on 1st of July. So matching price will consider its weighted buy price in desired output. Please find my &lt;STRONG&gt;Input Data&lt;/STRONG&gt; in below table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 406px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="text-align: center;" width="82"&gt;Trade Date&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="97"&gt;Flag&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="92"&gt;Shares&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="135"&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;100&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;505&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;520&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-125&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;530&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;2-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;480&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;6-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;492&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;8-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;475&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;10-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;503&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;15-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;515&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;21-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;540&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below table for &lt;STRONG&gt;Desired output&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, in case of 8July Sell, I had bought prior to 8July is&amp;nbsp; 50 shares on 2nd and 25 shares on 6July. Since my last 25 shares bought is for 6July, it will be matched considering LIFO logic and its price will be reflected in my matching price output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 568px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="text-align: center;" width="82"&gt;Trade Date&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="97"&gt;Flag&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="92"&gt;Shares&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="135"&gt;Price&lt;/TD&gt;&lt;TD class="xl66" style="text-align: center; border-left: medium none;" width="162"&gt;&lt;STRONG&gt;LIFO based Matching Price&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;100&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;505&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;520&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-125&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;530&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;(&lt;STRONG&gt;25*520+100*505)/125&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;2-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;480&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;6-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;492&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;8-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;475&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;25*492/25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;10-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;503&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;15-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;515&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;50*503/50&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;21-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;540&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;50*480/50&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requesting for sharing appropriate code considering this LIFO logic where I can get my desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Jul 2015 07:20:35 GMT</pubDate>
    <dc:creator>VISHALKAPASI</dc:creator>
    <dc:date>2015-07-29T07:20:35Z</dc:date>
    <item>
      <title>LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213174#M39381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings for the day...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, I want to pair my Sell transactions with Buy transactions considering LIFO logic. This means, whenever I sell shares I want to know its corresponding BUY, who were last bought prior to my Sell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, On 1 st of July, I bought 100, and 25 shares, and sold all 125 shares, So prior to selling 125 shares, my last bought 125 shares were also on 1st of July. So matching price will consider its weighted buy price in desired output. Please find my &lt;STRONG&gt;Input Data&lt;/STRONG&gt; in below table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 406px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="text-align: center;" width="82"&gt;Trade Date&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="97"&gt;Flag&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="92"&gt;Shares&lt;/TD&gt;&lt;TD class="xl63" style="text-align: center; border-left: medium none;" width="135"&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;100&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;505&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;520&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-125&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;530&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;2-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;480&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;6-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;492&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;8-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-25&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;475&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;10-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;503&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;15-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;515&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="border-top: medium none;"&gt;21-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; border-top: medium none;"&gt;540&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below table for &lt;STRONG&gt;Desired output&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, in case of 8July Sell, I had bought prior to 8July is&amp;nbsp; 50 shares on 2nd and 25 shares on 6July. Since my last 25 shares bought is for 6July, it will be matched considering LIFO logic and its price will be reflected in my matching price output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 568px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="text-align: center;" width="82"&gt;Trade Date&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="97"&gt;Flag&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="92"&gt;Shares&lt;/TD&gt;&lt;TD class="xl65" style="text-align: center; border-left: medium none;" width="135"&gt;Price&lt;/TD&gt;&lt;TD class="xl66" style="text-align: center; border-left: medium none;" width="162"&gt;&lt;STRONG&gt;LIFO based Matching Price&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;100&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;505&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;520&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-125&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;530&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;(&lt;STRONG&gt;25*520+100*505)/125&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;2-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;480&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;6-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;492&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;8-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-25&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;475&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;25*492/25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;10-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;503&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;15-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;515&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;50*503/50&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: medium none;"&gt;21-Jul-15&lt;/TD&gt;&lt;TD class="xl68" style="border-left: medium none; border-top: medium none;"&gt;Sell&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;-50&lt;/TD&gt;&lt;TD class="xl65" style="border-left: medium none; border-top: medium none;"&gt;540&lt;/TD&gt;&lt;TD class="xl69" style="border-left: medium none; border-top: medium none;"&gt;&lt;STRONG&gt;50*480/50&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requesting for sharing appropriate code considering this LIFO logic where I can get my desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 07:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213174#M39381</guid>
      <dc:creator>VISHALKAPASI</dc:creator>
      <dc:date>2015-07-29T07:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213175#M39382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if you can't find a perfect one ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl63" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit; text-align: center;" width="82"&gt;Trade Date&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: 0px 0px 0px medium; border-style: solid solid solid none; border-top-color: black; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit; text-align: center;" width="97"&gt;Flag&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: 0px 0px 0px medium; border-style: solid solid solid none; border-top-color: black; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit; text-align: center;" width="92"&gt;Shares&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: 0px 0px 0px medium; border-style: solid solid solid none; border-top-color: black; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit; text-align: center;" width="135"&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl64" height="20" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;100&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;505&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl64" height="20" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;Buy&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;25&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;520&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl64" height="20" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl65" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Sell&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;-50&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;"&gt;530&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 14:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213175#M39382</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-29T14:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213176#M39383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the above case where perfect qty not found, LIFO logic will consider last bought 50 shares prior to sell. So matching price will be calculated as (25*520+25*505)/50.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the revert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Vishal&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 15:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213176#M39383</guid>
      <dc:creator>VISHALKAPASI</dc:creator>
      <dc:date>2015-07-29T15:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213177#M39384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nothing like a brain teaser to start the day.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; T;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; SHARE $ DATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;anydtdte.&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; FLAG $ VOLUME PRICE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; DATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 503&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 515&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 540&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 503&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 515&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 540&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; S;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUMES [&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; PRICES&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; LIFO&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* populate arrays;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (last.SHARE);&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;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; T ;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; SHARE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRANSACTION+&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUMES[TRANSACTION]=VOLUME;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICES [TRANSACTION]=PRICE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* process array for this share;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; FWD=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; TRANSACTION;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUMES[FWD] &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* we have a sell;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUME=-VOLUMES[FWD];&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* store sell volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICE =&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* store cumulated price;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; BACK=FWD-&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; -&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (LIFO[FWD]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* look back to find previous buys;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUMES[BACK]&amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;continue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* not a buy ;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUMES[BACK] &amp;lt; -VOLUMES[FWD] &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* volume too small to complete price calculation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICE+PRICES[BACK]*VOLUMES[BACK];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* update buy price with this volume;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUMES[FWD]+VOLUMES[BACK];&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* reset tally for sell volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUMES[BACK]=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* reset tally for buy volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUMES[BACK] &amp;gt;= -VOLUMES[FWD] &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;%&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* price calculation can be completed;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRICE+PRICES[BACK]*-VOLUMES[FWD];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* update buy price;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUMES[BACK]+VOLUMES[FWD];&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* reset tally for buy volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LIFO[FWD]=PRICE/VOLUME;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* calculate lifo price;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* save LIFO prices;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; I=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; TRANSACTION; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; T&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LIFO_PRICE=LIFO&lt;I&gt;;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; missing (TRANSACTION, of VOLUMES&lt;LI&gt;, of PRICES&lt;/LI&gt;&lt;LI&gt;, of LIFO&lt;/LI&gt;&lt;LI&gt;);&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; SHARE DATE FLAG VOLUME PRICE LIFO_PRICE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 281px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="62"&gt;DATE&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="39"&gt;FLAG&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="62"&gt;VOLUME&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="42"&gt;PRICE&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="76"&gt;LIFO_PRICE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Buy&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="62"&gt;100&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;505&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="76"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Buy&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="62"&gt;25&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;520&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="76"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Sell&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;-50&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;530&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;" width="76"&gt;512.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;1-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Sell&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;-75&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;530&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;" width="76"&gt;505&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;2-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Buy&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="62"&gt;50&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;480&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="76"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;6-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Buy&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="62"&gt;25&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;492&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="76"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;8-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Sell&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;-25&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;475&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;" width="76"&gt;492&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;10-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Buy&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="62"&gt;50&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;503&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="76"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl68" height="20" style="border-top: none;" width="62"&gt;15-Jul-15&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;" width="39"&gt;Sell&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;-50&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;" width="42"&gt;515&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;" width="76"&gt;503&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl70" height="21" style="border-top: none;" width="62"&gt;21-Jul-15&lt;/TD&gt;&lt;TD class="xl71" style="border-top: none; border-left: none;" width="39"&gt;Sell&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none; border-left: none;"&gt;-50&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none; border-left: none;" width="42"&gt;540&lt;/TD&gt;&lt;TD align="right" class="xl73" style="border-top: none; border-left: none;" width="76"&gt;480&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now do this in SQL or using drag'n'drop.. Ha!&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 22:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213177#M39384</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-07-29T22:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213178#M39385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great.!!&amp;nbsp; You have created LIFO logic code in a Flash.. Amazing..!! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hates off to you Sir..&amp;nbsp;&amp;nbsp;&amp;nbsp; Big Thanks.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will really help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vishal Kapasi &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 06:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213178#M39385</guid>
      <dc:creator>VISHALKAPASI</dc:creator>
      <dc:date>2015-07-30T06:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213179#M39386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Hates off to you Sir..&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope not !&amp;nbsp; &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 01:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213179#M39386</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-07-31T01:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213180#M39387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data have;
input id $ DATE anydtdte.&amp;nbsp; FLAG $ share price;
format DATE date9.;
cards;
A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505
A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520
A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530
A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530
A 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480
A 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492
A 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475
A 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 503
A 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 515
A 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 540
B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505
B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520
B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530
B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530
B 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480
B 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492
B 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475
B 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 503
B 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 515
B 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 540
;
run;


data x;
 set have;
 k+1;
 rename share=_s price=_p;
 keep k share price;
run;
data want;
 if _n_ eq 1 then do;
&amp;nbsp; if 0 then set x;
&amp;nbsp; declare hash ha(dataset:'x');
&amp;nbsp; ha.definekey('k');
&amp;nbsp; ha.definedata('_s','_p');
&amp;nbsp; ha.definedone();
 end;
set have nobs=nobs;
k=_n_; _share=share;sum=0;
if share lt 0 then do;
 ha.remove();
 do i=1 to nobs;
&amp;nbsp;&amp;nbsp; k=k-1;
&amp;nbsp;&amp;nbsp; rc=ha.find(); 
&amp;nbsp;&amp;nbsp; if rc=0 then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _share=_share+_s;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _share lt 0 then do; sum+_s*_p;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ha.remove();end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dif=_s-_share;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum+dif*_p;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _s=_share;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ha.replace(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *put k= _share= _s= _p= sum= dif=;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; end;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if _share ge 0 then leave;
 end;
LIFO=divide(sum,abs(share));
end;
drop k i _s _p sum _share dif rc ;
run;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 02:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213180#M39387</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-31T02:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213181#M39388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can use hash table, which alleviates the need to size the arrays, but they are harder to understand.&lt;/P&gt;&lt;P&gt;No need to store the sell operations in the hash table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that at no point do we check the buy volumes are sufficient to cover the sell volumes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why the heck to spaces get wrecked when pasting and ruin the alignment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; HAVE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; SHARE $ DATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;anydtdte.&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; FLAG $ VOLUME PRICE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; DATE &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;N=_N_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50 503&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50 515&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50 540&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 505&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 520&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -50&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 1-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -75&amp;nbsp;&amp;nbsp;&amp;nbsp; 530&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 2-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 480&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 6-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Buy 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 8-Jul-15&amp;nbsp;&amp;nbsp;&amp;nbsp; Sell -25&amp;nbsp;&amp;nbsp;&amp;nbsp; 475&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 10-Jul-15&amp;nbsp;&amp;nbsp; Buy&amp;nbsp;&amp;nbsp;&amp;nbsp; 50 503&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 15-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50 515&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B 21-Jul-15&amp;nbsp;&amp;nbsp; Sell&amp;nbsp;&amp;nbsp; -50 540&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; WANT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _N_ eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;declare&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;hash&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; BUYS(dataset:&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'HAVE(keep&amp;nbsp;&amp;nbsp; = N VOLUME PRICE &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename = (VOLUME=_V PRICE=_P) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&amp;nbsp; = (_V&amp;gt;0))'&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; BUYS.definekey(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'N'&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; BUYS.definedata(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'_V'&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'_P'&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; BUYS.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; missing( _V, _P);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; HAVE ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; SUM =&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* store cumulated price;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; VOLUME_TALLY=VOLUME;&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;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* store sell volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUME &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; N=_N_-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; -&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (LIFO); %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* we have a sell;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; RC=BUYS.find();&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;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* look back to find previous buys;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; RC=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* found ;&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _V &amp;lt; -VOLUME_TALLY &lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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; %&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* volume too small to complete price calculation;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM+_P*_V&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;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* update buy price with this volume;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VOLUME_TALLY+_V;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* reset tally for sell volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BUYS.remove();&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* remove buy volume;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: 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;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* price calculation can be completed;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM+_P*-VOLUME_TALLY;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* update buy price;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _V+VOLUME_TALLY;&amp;nbsp;&amp;nbsp; BUYS.replace();&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* reset&amp;nbsp; buy volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LIFO=SUM/VOLUME;&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: 8.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* calculate lifo price;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; VOLUME_TALLY RC SUM N _: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 8.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 04:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213181#M39388</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2015-07-31T04:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213182#M39389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"they are harder to understand"&lt;/P&gt;&lt;P&gt;But are easier to use ( no need to change the size of array ), right ?&lt;/P&gt;&lt;P&gt;Write once, Use anytime anywhere. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 05:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213182#M39389</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-31T05:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: LIFO logic for calculating return from shares held</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213183#M39390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I meant Hats off to you Sir, I am amazed with your prompt n perfect reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls forgive me for d spelling mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp;Regards, &lt;/P&gt;&lt;P&gt;Vishal &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 05:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIFO-logic-for-calculating-return-from-shares-held/m-p/213183#M39390</guid>
      <dc:creator>VISHALKAPASI</dc:creator>
      <dc:date>2015-07-31T05:47:33Z</dc:date>
    </item>
  </channel>
</rss>

