title: Annual return from monthly return
body: <p>I want to calculate annual return from the monthly returns. For example, 
  Annual Return=(1+ret_m1)*(1+ret_m2)+.....+(1+ret_m12)-1</p>
  
  <p>How should I calculate in Stata? </p>
  
  <pre><code>  * Example generated by -dataex-. To install: ssc install dataex
  clear
  input double permno long date str8(ncusip cusip) double vwretd
  10001 10255 "39040610" "36720410"    .04488041
  10001 10286 "39040610" "36720410"    .05169475
  10001 10317 "39040610" "36720410"   -.01659759
  10001 10346 "39040610" "36720410"    .01099083
  10001 10378 "39040610" "36720410"   .000447785
  10001 10408 "39040610" "36720410"    .05145973
  10001 10437 "39040610" "36720410"  -.007271962
  10001 10470 "39040610" "36720410"   -.02800588
  10001 10500 "39040610" "36720410"    .03720232
  10001 10531 "39040610" "36720410"    .01764623
  10001 10561 "39040610" "36720410"   -.01641204
  10001 10591 "39040610" "36720410"    .02107465
  10001 10623 "39040610" "36720410"    .06610259
  10001 10651 "39040610" "36720410"   -.01644639
  10001 10682 "39040610" "36720410"    .02146523
  10001 10710 "39040610" "36720410"    .04820446
  10001 10743 "39040610" "36720410"    .03933809
  10001 10773 "39040610" "36720410"  -.004866142
  10001 10804 "39040610" "36720410"    .07713073
  10001 10835 "39040610" "36720410"     .0221267
  10001 10864 "39040610" "36720410"  -.001474362
  10001 10896 "39040610" "36720410"   -.02928529
  10001 10926 "39040610" "36720410"     .0178139
  10001 10955 "39040610" "36720410"    .01829512
  10001 10988 "39040610" "36720410"   -.07011517
  10001 11016 "39040610" "36720410"    .01490096
  10001 11046 "39040610" "36720410"    .02414006
  10001 11077 "39040610" "36720410"    -.0282857
  10001 11108 "39040610" "36720410"    .08893429
  10001 11137 "39040610" "36720410"  -.004196256
  10001 11169 "39040610" "36720410"  -.009402919
  10001 11200 "39040610" "36720410"   -.09190542
  10001 11228 "39040610" "36720410"   -.05384322
  10001 11261 "39040610" "36720410"   -.01250398
  10001 11291 "39040610" "36720410"    .06574359
  10001 11322 "39040610" "36720410"    .02951265
  10001 11353 "39040610" "36720410"    .04907785
  10001 11381 "39040610" "36720410"    .07584678
  10001 11409 "39040610" "36720410"    .02892273
  10001 11442 "39040610" "36720410"   .003314882
  10001 11473 "39040610" "36720410"     .0407327
  10001 11501 "39040610" "36720410"   -.04402925
  10001 11534 "39040610" "36720410"    .04679512
  10001 11564 "39040610" "36720410"     .0268165
  10001 11595 "39040610" "36720410"   -.01097486
  10001 11626 "39040610" "36720410"    .01781452
  10001 11655 "39040610" "36720410"   -.03727527
  10001 11687 "39040610" "36720410"     .1067778
  10001 11718 "39040610" "36720410"  -.001182341
  10001 11746 "39040610" "36720410"    .01335434
  10001 11778 "39040610" "36720410"   -.02369961
  10001 11808 "39040610" "36720410"    .01341884
  10001 11837 "39040610" "36720410"   .006438549
  10001 11869 "39040610" "36720410"   -.01927053
  10001 11900 "39040610" "36720410"    .03989998
  10001 11931 "39040610" "36720410"   -.02081965
  10001 11961 "39040610" "36720410"    .01244722
  10001 11991 "39040610" "36720410"    .01098552
  10001 12022 "39040610" "36720410"    .04019304
  10001 12053 "39040610" "36720410"    .01776835
  10001 12082 "39040610" "36720410"    .01264374
  10001 12110 "39040610" "36720410"   .005402277
  10001 12143 "39040610" "36720410"     .0251157
  10001 12173 "39040610" "36720410"   -.02540042
  10001 12201 "39040610" "36720410"    .02959926
  10001 12234 "39040610" "36720410"   .005440016
  10001 12264 "39040610" "36720410" -.0007919354
  10001 12296 "39040610" "36720410"    .03947853
  10001 12326 "39040610" "36720410"  .0006406767
  10001 12355 "39040610" "36720410"    .01806427
  10001 12387 "29274A10" "36720410"   -.01760636
  10001 12418 "29274A10" "36720410"    .01951495
  10001 12449 "29274A10" "36720410"    .03146612
  10001 12477 "29274A10" "36720410"   -.02422607
  10001 12508 "29274A10" "36720410"   -.04579477
  10001 12537 "29274A10" "36720410"   .009477681
  10001 12569 "29274A10" "36720410"   .009360213
  10001 12599 "29274A10" "36720410"   -.02790886
  10001 12628 "29274A10" "36720410"    .03063324
  10001 12661 "29274A10" "36720410"    .04259737
  10001 12691 "29274A10" "36720410"   -.01836337
  10001 12722 "29274A10" "36720410"    .01451999
  10001 12752 "29274A10" "36720410"   -.03721879
  10001 12782 "29274A10" "36720410"    .01260929
  10001 12814 "29274A10" "36720410"    .02039915
  10001 12842 "29274A10" "36720410"    .03961473
  10001 12873 "29274A10" "36720410"    .02704092
  10001 12901 "29274A10" "36720410"    .02504808
  10001 12934 "29274A10" "36720410"    .03400705
  10001 12964 "29274A10" "36720410"    .03117276
  10001 12995 "29274A10" "36720410"    .04078258
  10001 13026 "29274A10" "36720410"   .009303724
  10001 13055 "29274A10" "36720410"     .0363627
  10001 13087 "29274A10" "36720410"   -.01131678
  10001 13117 "29274A10" "36720410"    .04280756
  10001 13146 "29274A10" "36720410"    .01519028
  10001 13179 "29274A10" "36720410"     .0281413
  10001 13208 "29274A10" "36720410"    .01631008
  10001 13237 "29274A10" "36720410"    .01092697
  10001 13269 "29274A10" "36720410"    .02551078
  end
  format %d date
  </code></pre>