Dear Statalist members,
Currently, I have a large panel dataset with monthly returns and 5 portfolio's based on the company's R&D expenditures scaled by market cap. The portfolio's are formed on a yearly basis in June.
Now, I want to perform a similar analysis as Louis K. C. Chan, Josef Lakonishok, Theodore Sougiannis (2001) The Stock Market Valuation of Research and Development Expenditures (wiley.com)
and calculate each portfolio’s average annual buy-and-hold return over the five years prior to portfolio formation; over each year from one to three years after portfolio formation; and averaged over the three post formation years.
I have been searching through Statalist and haven't been able to find a fitting solution.
I used the following code to calculate the average yearly returns from July to June:
A sample of my dataset is given below:
usret are the monthly returns and functional_year are adjusted years in order to create portfolio's in June.
Thank you in advance.
Currently, I have a large panel dataset with monthly returns and 5 portfolio's based on the company's R&D expenditures scaled by market cap. The portfolio's are formed on a yearly basis in June.
Now, I want to perform a similar analysis as Louis K. C. Chan, Josef Lakonishok, Theodore Sougiannis (2001) The Stock Market Valuation of Research and Development Expenditures (wiley.com)
and calculate each portfolio’s average annual buy-and-hold return over the five years prior to portfolio formation; over each year from one to three years after portfolio formation; and averaged over the three post formation years.
I have been searching through Statalist and haven't been able to find a fitting solution.
I used the following code to calculate the average yearly returns from July to June:
Code:
bys gvkey functional_year: asrol usret, s(product) add(1)
usret are the monthly returns and functional_year are adjusted years in order to create portfolio's in June.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long gvkey float(monthly_date functional_year usret) int portfolio 1166 480 1999 .09326574 . 1166 481 1999 .24016953 . 1166 482 1999 -.03944441 . 1166 483 1999 .09743556 . 1166 484 1999 -.18024014 . 1166 485 1999 -.02928259 4 1166 486 2000 .0041769478 4 1166 487 2000 -.03308512 4 1166 488 2000 -.3078191 4 1166 489 2000 -.08736072 4 1166 490 2000 -.25651398 4 1166 491 2000 -.1653086 4 1166 492 2000 .83484 4 1166 493 2000 -.23410656 4 1166 494 2000 .25346023 4 1166 495 2000 .28960082 4 1166 496 2000 -.03155282 4 1166 497 2000 -.10982657 4 1166 498 2001 .1799191 4 1166 499 2001 -.07481738 4 1166 500 2001 -.4534363 4 1166 501 2001 .3561824 4 1166 502 2001 -.04567805 4 1166 503 2001 .26718995 4 1166 504 2001 -.04475289 4 1166 505 2001 .16981766 4 1166 506 2001 .20963725 4 1166 507 2001 -.09086589 4 1166 508 2001 -.1571756 4 1166 509 2001 -.10014753 4 1166 510 2002 -.20050375 4 1166 511 2002 -.10503826 4 1166 512 2002 -.3212182 4 1166 513 2002 .4437673 4 1166 514 2002 .18151404 4 1166 515 2002 -.16748233 4 1166 516 2002 -.070448406 4 1166 517 2002 -.06056389 4 1166 518 2002 -.07760751 4 1166 519 2002 .3715606 4 1166 520 2002 .11765788 4 1166 521 2002 -.016138405 4 1166 522 2003 .09858018 4 1166 523 2003 .0983443 4 1166 524 2003 -.17749813 4 1166 525 2003 .16874777 4 1166 526 2003 .09141434 4 1166 527 2003 .08301782 4 1166 528 2003 .20377997 4 1166 529 2003 -.033443805 4 1166 530 2003 -.08524045 4 1166 531 2003 -.05383456 4 1166 532 2003 .05642015 4 1166 533 2003 -.05474057 4 1166 534 2004 -.2002851 4 1166 535 2004 -.17819238 4 1166 536 2004 -.015646597 4 1166 537 2004 .0836684 4 1166 538 2004 .10904754 4 1166 539 2004 .03131096 4 1166 540 2004 .04676875 4 1166 541 2004 .08513923 4 1166 542 2004 -.1207189 4 1166 543 2004 -.1816186 4 1166 544 2004 .08113027 4 1166 545 2004 .09968112 5 1166 546 2005 -.04954542 5 1166 547 2005 -.0040854593 5 1166 548 2005 -.074489646 5 1166 549 2005 -.05107221 5 1166 550 2005 .08450764 5 1166 551 2005 .15371233 5 1166 552 2005 .07936773 5 1166 553 2005 .025984926 5 1166 554 2005 .09050346 5 1166 555 2005 -.031871576 5 1166 556 2005 -.1236107 5 1166 557 2005 -.09585842 5 1166 558 2006 .00260001 5 1166 559 2006 .12154625 5 1166 560 2006 .05270199 5 1166 561 2006 -.003385211 5 1166 562 2006 .14366731 5 1166 563 2006 .006545564 5 1166 564 2006 .08208212 5 1166 565 2006 .011137736 5 1166 566 2006 -.037013546 5 1166 567 2006 .10437811 5 1166 568 2006 .0767234 5 1166 569 2006 .018718403 5 1166 570 2007 .064965375 5 1166 571 2007 -.035208344 5 1166 572 2007 .033553373 5 1166 573 2007 -.007563786 5 1166 574 2007 -.1611297 5 1166 575 2007 .04338603 5 1166 576 2007 -.2311015 5 1166 577 2007 .03997261 5 1166 578 2007 -.06573582 5 1166 579 2007 .27299738 5 end format %tm monthly_date
