Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cumulative Returns

    I want to calculate the cumulative return by firm between the financial statements announcement dates. I have a lot of fims in my sample and, consequently, the period of time to acccumulate the return by firm is not the same for every year.


    Following is a example:

    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str10 nome long data float ln_ibrx
    "" 20100201 .01548551
    "Abc Brasil" 20100202 .00705269
    "" 20100203 .0001464721
    "" 20100204 -.04550696
    "" 20100205 -.01955403
    "" 20100208 .004655741
    "" 20100209 .02371751
    "" 20100210 .006023053
    "" 20100211 .016052654
    "" 20100212 -.003114336
    "" 20100217 .02038598
    "" 20100218 .00727148
    "" 20100219 -.005275429
    "" 20100222 -.006198696
    "" 20100223 -.016333384
    "" 20100224 -.003820685
    "" 20100225 .0040268195
    "" 20100226 .006304397
    "" 20100301 .009415252
    "" 20100302 .008277865
    "" 20100303 -.00021809617
    "" 20100304 .0007261788
    "" 20100305 .01386975
    "" 20100308 -.003013507
    "" 20100309 .013404242
    "" 20100310 .004963253
    "" 20100311 -.0007461697
    "" 20100312 -.007209466
    "" 20100315 -.0033224404
    "" 20100316 .012256977
    "" 20100317 -.0029464085
    "" 20100318 -.0022450543
    "" 20100319 -.012158155
    "" 20100322 .003812366
    "" 20100323 .0020866748
    "" 20100324 -.005988625
    "" 20100325 -.006032603
    "" 20100326 .003402446
    "" 20100329 .015020214
    "" 20100330 .0014771627
    "" 20100331 .005985625
    "" 20100401 .009914588
    "" 20100405 .0027167536
    "" 20100406 -.002006077
    "" 20100407 -.002676853
    "" 20100408 .01382804
    "" 20100409 -.0041837064
    "" 20100412 -.012646815
    "" 20100413 .000733122
    "" 20100414 .004613341
    "" 20100415 -.006150903
    "" 20100416 -.016944056
    "" 20100419 -.003032876
    "" 20100420 .004777521
    "" 20100422 -.0014182093
    "" 20100423 .0019531797
    "" 20100426 -.01000712
    "" 20100427 -.03305437
    "" 20100428 .002449677
    "" 20100429 .01878552
    "" 20100430 -.005397597
    "" 20100503 -.01127605
    "" 20100504 -.032742087
    "" 20100505 .0013825204
    "" 20100506 -.016514722
    "" 20100507 -.006785458
    "" 20100510 .035572793
    "" 20100511 -.013882626
    "" 20100512 .008974887
    "" 20100513 -.005965644
    "" 20100514 -.0173465
    "" 20100517 -.00612283
    "" 20100518 -.027640853
    "" 20100519 -.022546556
    "" 20100520 -.02758209
    "" 20100521 .033052858
    "" 20100524 -.006249474
    "" 20100525 -.01370723
    "" 20100526 .014763827
    "" 20100527 .03069436
    "" 20100528 -.000640342
    "" 20100531 .02284885
    "" 20100601 -.02089637
    "" 20100602 .017413381
    "" 20100604 -.017219875
    "" 20100607 -.009332366
    "" 20100608 .008888113
    "" 20100609 -.003712368
    "" 20100610 .02094485
    "" 20100611 .006109496
    "" 20100614 -.004905867
    "" 20100615 .013494988
    "" 20100616 .005618304
    "" 20100617 -.005128673
    "" 20100618 -.000768185
    "" 20100621 .008011871
    "" 20100622 -.0036776084
    "" 20100623 .0029862004
    "" 20100624 -.02094062
    "" 20100625 .013294999
    "" 20100628 -.009104714
    "" 20100629 -.0335708
    "" 20100630 -.015748825
    "" 20100701 .007958519
    "" 20100702 .0039872653
    "" 20100705 -.010612687
    "" 20100706 .019826684
    "" 20100707 .021015666
    "" 20100708 .0049824
    "" 20100712 -.007566669
    "" 20100713 .00863789
    "" 20100714 -.003565341
    "" 20100715 -.00150469
    "" 20100716 -.017092796
    "" 20100719 .015384973
    "" 20100720 .02057713
    "" 20100721 -.0007529311
    "" 20100722 .019029206
    "" 20100723 .006535316
    "" 20100726 .0013774858
    "" 20100727 .001415894
    "" 20100728 .006692177
    "" 20100729 .00014010674
    "" 20100730 .00787013
    "" 20100802 .014973422
    "" 20100803 -.006256967
    "" 20100804 .0023233653
    "" 20100805 .002020768
    "" 20100806 -.003468551
    "" 20100809 -.0021526173
    "" 20100810 -.009014559
    "" 20100811 -.022313116
    "" 20100812 .004086641
    "" 20100813 .0020864026
    "" 20100816 .006851395
    "" 20100817 .011116253
    "" 20100818 -.00016024637
    "" 20100819 -.01186261
    "" 20100820 -.0028360414
    "" 20100823 -.009893546
    "" 20100824 -.01411115
    "" 20100825 -.004996696
    "" 20100826 -.013577537
    "" 20100827 .027103774
    "" 20100830 -.019649027
    "" 20100831 .015309188
    "" 20100901 .028026974
    "" 20100902 -.006133024
    "" 20100903 .0016789836
    "" 20100906 .0005189099
    "" 20100908 -.007422655
    "" 20100909 .00010490756
    "" 20100910 .0009076163
    "" 20100913 .02032647
    "" 20100914 -.005429443
    "" 20100915 .005314962
    "" 20100916 -.005544237
    "" 20100917 -.007041194
    "" 20100920 .015034274
    "" 20100921 -.00868786
    "" 20100922 .00631487
    "" 20100923 .007464138
    "" 20100924 -.006063567
    "" 20100927 .010048976
    "" 20100928 .005771614
    "" 20100929 .008220281
    "" 20100930 .003618965
    "" 20101001 .010296718
    "" 20101004 .0018589023
    "" 20101005 .011253995
    "" 20101006 -.010784387
    "" 20101007 -.00805176
    "" 20101008 .014244474
    "" 20101011 .0010978605
    "" 20101013 .008577881
    "" 20101014 .00035574575
    "" 20101015 .000641801
    "" 20101018 .0010924251
    "" 20101019 -.02450944
    "" 20101020 .007058336
    "" 20101021 -.011369086
    "" 20101022 -.00005070722
    "" 20101025 .005682364
    "" 20101026 .016184792
    "" 20101027 -.006184341
    "" 20101028 -.00470528
    "" 20101029 .0039427057
    "" 20101101 .01433982
    "" 20101103 .005397615
    "" 20101104 .017578855
    "" 20101105 -.0037653735
    "" 20101108 .003402399
    "" 20101109 -.013610138
    "" 20101110 .0008781021
    "" 20101111 -.009770552
    "" 20101112 -.011594182
    "" 20101116 -.016379397
    "" 20101117 .004566566
    "" 20101118 .015523665
    "" 20101119 .002820933
    "" 20101122 -.016186694
    "" 20101123 -.021786403
    "" 20101124 .021388015
    "" 20101125 -.005042261
    "" 20101126 -.012642575
    "" 20101129 -.002939787
    "" 20101130 -.005336011
    "" 20101201 .022935146
    "" 20101202 .003865587
    "" 20101203 .0013483926
    "" 20101206 -.003162241
    "" 20101207 -.005248783
    "" 20101208 -.012739833
    "" 20101209 -.0019543061
    "" 20101210 .006061327
    "" 20101213 .01158293
    "" 20101214 -.002892187
    "" 20101215 -.01075413
    "" 20101216 -.005435814
    "" 20101217 .009464212
    "" 20101220 -.010591313
    "" 20101221 .01274356
    "" 20101222 .005222335
    "" 20101223 .0003664169
    "" 20101227 -.00958547
    "" 20101228 .0038079156
    "" 20101229 .012289995
    "" 20101230 .00676217
    "" 20110103 .008869023
    "" 20110104 .005176521
    "" 20110105 .0116679
    "" 20110106 -.009220785
    "" 20110107 -.010193605
    "" 20110110 .0024144156
    "" 20110111 .00534316
    "" 20110112 .01704833
    "" 20110113 -.013811623
    "" 20110114 .004501189
    "" 20110117 -.003573543
    "" 20110118 .0024245975
    "" 20110119 -.01307254
    "" 20110120 -.008626674
    "" 20110121 -.004774143
    "" 20110124 .005646552
    "" 20110126 -.008166654
    "" 20110127 -.006678906
    "" 20110128 -.019311316
    "" 20110131 -.0012330292
    "" 20110201 .016086698
    "" 20110202 -.01171
    "" 20110203 .00012292537
    "" 20110204 -.02119798
    "" 20110207 .0021387152
    "" 20110208 .004536287
    "" 20110209 -.024097
    "" 20110210 .0044298763
    "Abc Brasil" 20110211 .018408349
    "" 20110214 .011915598
    "" 20110215 .002592566
    "" 20110216 .017083665

    I just include one firm to give an example. I want the cumulative return (ln_ibrx) between 20100202 to 20110211 for "Abc Brasil".

    Does anyone have any idea about how to do this?

    Thank you!


    Last edited by Alysson Francisco; 22 May 2019, 19:08.

  • #2
    Is this what you looking for:

    Code:
    replace nome = nome[_n -1] if nome =="" & data <= 20110211
    bys nome: gen cumulative_return = sum(ln_ibrx) if nome != ""

    Comment


    • #3
      You can download ascol from SSC and use it to find cumulative returns. This blog post presents several examples of how to do it. In that post, please pay attention to the method in which the returns were generated in the first step. The method used to find cumulative returns will depend on that first step.

      General introduction to ascol with examples - Read here

      Period cumulative returns with examples - Read here
      Last edited by Attaullah Shah; 24 May 2019, 11:05.
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment


      • #4
        Thank you both for your responses!

        I used the ascol command and solved my problem.

        Great work Attaullah Shah.



        Comment

        Working...
        X