<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to calculate a statistical herding measure for financial data in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-a-statistical-herding-measure-for-financial/m-p/262014#M13848</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Did you figure it out? Would really appreciate if you could share the calculation with me.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2016 08:45:21 GMT</pubDate>
    <dc:creator>Gurjen</dc:creator>
    <dc:date>2016-04-07T08:45:21Z</dc:date>
    <item>
      <title>How to calculate a statistical herding measure for financial data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-a-statistical-herding-measure-for-financial/m-p/163675#M8558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;Hi good day everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;I am a at the moment trying to figure out&amp;nbsp; how to go about calculating the Lakonishok, Shleifer and Vishny (1992) measure for determining the degree of investor herding behavior in a stock market. &lt;SPAN style="font-style: inherit;"&gt;The SAS data file I am using consists of the variables: stock symbol (ticker), the volume traded (tvol), trade price (tprice), the trade value (tval), the client who initiated the trade (client), trade date (tdate), the time of the trade (rt), the sign indicating whether the trade initiated was a buy/sell (sign) as well as industry sector (sector) and the market the stock traded belongs to (market).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;The LSV (1992) measure is as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;A _jive_internal="true" href="/servlet/JiveServlet/showImage/2-211935-6338/Screen Shot 2014-05-17 at 12.47.08 PM.png" style="font-style: inherit; font-family: inherit; color: #0e66ba;"&gt;&lt;IMG alt="Screen Shot 2014-05-17 at 12.47.08 PM.png" class="jive-image-thumbnail jive-image jiveImage" height="331" src="https://communities.sas.com/legacyfs/online/6341_Screen Shot 2014-05-17 at 12.47.08 PM.png" style="border: 0px; font-style: inherit; font-family: inherit;" width="663" /&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;Thus far I believe I have been able to calculate P(i,t), using the below formula&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;A _jive_internal="true" href="/servlet/JiveServlet/showImage/2-211935-6339/Screen Shot 2014-05-17 at 12.57.26 PM.png" style="font-style: inherit; font-family: inherit; color: #0e66ba;"&gt;&lt;IMG alt="Screen Shot 2014-05-17 at 12.57.26 PM.png" class="jive-image-thumbnail jive-image jiveImage" height="70" src="https://communities.sas.com/legacyfs/online/6342_Screen Shot 2014-05-17 at 12.57.26 PM.png" style="border: 0px; font-style: inherit; font-family: inherit;" width="450" /&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;and after much help, the sas code I used to find P(i,t):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;data a (drop = market buyer seller tdate);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;set TMP1.ttsetrades(where = (market = 'First Tier'));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;timePeriod = intnx("WEEK", tdate, 0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;format timePeriod date9.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;proc sort data=a;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;by ticker timePeriod client;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;data b(drop=tvol sign);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;do until (last.client);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set a; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by ticker timePeriod client;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stvol = sum(stvol, tvol*sign);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;data Pit (keep=timePeriod ticker buyingClients totalClients herding);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;buyingClients = 0; totalClients = 0;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;do until(last.timePeriod);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set b; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by ticker timePeriod;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buyingClients + (stvol &amp;gt; 0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totalClients + (stvol ne 0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Pit = buyingClients/totalClients;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12pt; font-family: 'Times New Roman';"&gt;I am stuck as to how to proceed from this point, any help given will be so much appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 16px; font-family: 'Times New Roman';"&gt;A&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 May 2014 15:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-a-statistical-herding-measure-for-financial/m-p/163675#M8558</guid>
      <dc:creator>Aleres</dc:creator>
      <dc:date>2014-05-18T15:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a statistical herding measure for financial data</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-a-statistical-herding-measure-for-financial/m-p/262014#M13848</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Did you figure it out? Would really appreciate if you could share the calculation with me.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 08:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-calculate-a-statistical-herding-measure-for-financial/m-p/262014#M13848</guid>
      <dc:creator>Gurjen</dc:creator>
      <dc:date>2016-04-07T08:45:21Z</dc:date>
    </item>
  </channel>
</rss>

