<?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 compounded return in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426291#M105023</link>
    <description>&lt;P&gt;Thanks do you think my code is correct. I am trying to calculate compounded returns between earnings announcement dates. I am just curious how the code treats the 0 returns. These are not missing values.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=have2 noprint;
  where 3&amp;lt;=td_count and date&amp;lt;=leadrdq1;
  by permno rdq;
  var _ret_plus1;
  output out=need2 n=n geomean=gm_ret_plus1;
run;

data Ret2;
  set need2;
  compound_ret=gm_ret_plus1**n-1;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2018 01:43:48 GMT</pubDate>
    <dc:creator>Agent1592</dc:creator>
    <dc:date>2018-01-10T01:43:48Z</dc:date>
    <item>
      <title>How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425960#M104923</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* a) CAR1 (3-day window);
proc means data=sample noprint;
   *define the even window and check that the start date is not far from report date;
   where -1&amp;lt;=td_count&amp;lt;=1 and intck('day',rdq,date)&amp;lt;=5;
   by permno rdq;
   var ret;
   output out=CAR1 (rename=(_freq_=daysCAR1)) sum=CAR1;
run;

* b) CAR2 (between consequent quarterly earnings announcement dates);
proc means data=sample noprint;
   where 3&amp;lt;=td_count and date&amp;lt;=leadrdq1;
   by permno rdq;
   var ret;
   output out=CAR2 (rename=(_freq_=daysCAR2)) sum=CAR2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am trying to calculate returns around earnings announcement dates. The code above calculates summed returns. Does anybody know how to calculate compounded returns?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 04:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425960#M104923</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2018-01-09T04:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425962#M104924</link>
      <description>&lt;P&gt;It's late so my brain isn't working at the moment but I think there's a trick of some sort using either geometric means or log() of a value. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 04:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425962#M104924</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-09T04:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425963#M104925</link>
      <description>&lt;P&gt;It's late so my brain isn't working at the moment but I think there's a trick of some sort using either geometric means or log() of a value. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 04:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425963#M104925</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-09T04:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425981#M104930</link>
      <description>&lt;P&gt;So&amp;nbsp;rdq is the announcement date right? And&amp;nbsp;td_count represents the days until/since the announcement date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what does your desired output data set look like?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 08:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/425981#M104930</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-09T08:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426054#M104952</link>
      <description>&lt;P&gt;Check function&amp;nbsp; FINANCE() ,maybe you could find answer in it.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 12:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426054#M104952</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-01-09T12:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426056#M104953</link>
      <description>&lt;P&gt;Since proc univariate can produce a geometric mean, it can help generate a compound return:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
  set have;
  _ret_plus1=ret+1;
run;

proc univariate data=have2 noprint;
  where -1&amp;lt;=td_count&amp;lt;=1 and intck('day',rdq,date)&amp;lt;=5;
  by permno rdq;
  var _ret_plus1;
  output out=need n=n geomean=gm_ret_plus1;
run;

data want;
  set need;
  compound_ret=gm_ret_plus1**n-1;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 12:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426056#M104953</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-09T12:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426202#M104999</link>
      <description>&lt;P&gt;Yes rdq is the announcement date. For the first types of returns CAR1 I am trying to calculate compounded returns around the announcement date (1 day before and 1 day after). -1&amp;lt;=td_count&amp;lt;=1&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the second types of returns CAR2 I am trying to calculate returns around announcements dates 3 days after the announcement until the following announcement. (3&amp;lt;=td_count and date&amp;lt;=leadrdq1).&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 19:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426202#M104999</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2018-01-09T19:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426222#M105001</link>
      <description>&lt;P&gt;Thank you for the proposed solution. This is excellent. Do you know why there is a column called number of non-missing values. Why is it set to 3? Is it from the univarariate proc?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 20:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426222#M105001</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2018-01-09T20:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426276#M105022</link>
      <description>&lt;P&gt;You need to know the number of non-missing values of _RET_PLUS1 because the geometric mean of _RET_PLUS1 is the constant value that would be required on each day&amp;nbsp;to get to the compound return of the actual varying values of RET.&amp;nbsp;&amp;nbsp; So you need to know how many days were used to get the geometric mean, which you see used&amp;nbsp; in may DATA WANT step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now perhaps you always know the number of days satisfying your WHERE filter, but my solution adapts to instances of missing records within the date ranges.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 23:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426276#M105022</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-09T23:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426291#M105023</link>
      <description>&lt;P&gt;Thanks do you think my code is correct. I am trying to calculate compounded returns between earnings announcement dates. I am just curious how the code treats the 0 returns. These are not missing values.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=have2 noprint;
  where 3&amp;lt;=td_count and date&amp;lt;=leadrdq1;
  by permno rdq;
  var _ret_plus1;
  output out=need2 n=n geomean=gm_ret_plus1;
run;

data Ret2;
  set need2;
  compound_ret=gm_ret_plus1**n-1;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 01:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426291#M105023</guid>
      <dc:creator>Agent1592</dc:creator>
      <dc:date>2018-01-10T01:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate compounded return</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426308#M105027</link>
      <description>&lt;P&gt;You have asked a good question, which you can answer by looking at some data with zero returns.&amp;nbsp; It's your turn now, to not just&amp;nbsp; use the code I suggested, but to understand it through testing.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 05:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-compounded-return/m-p/426308#M105027</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-10T05:02:31Z</dc:date>
    </item>
  </channel>
</rss>

