Hi,

I have a dataset that has a los of isin codes in it and I need to adjust the total return for each of them. Is there a possibility shortcut it or do I have to do each one by one?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(us89832q1094 us9497461015 fund) byte deal double(mktrf smb hml) float monthly_date
4334.62  8522.38   26.6  6 -3.36   .34   .29 600
4848.77  9134.96    2.3  2   3.4  1.48  3.18 601
4776.61   8651.4  27.07  7  6.31   1.8  2.16 602
5579.01  9923.02   57.6  8     2  4.99  2.93 603
5897.61 10716.98    5.3  4 -7.89   .09  -2.4 604
5138.19  8943.44   40.8  5 -5.57 -2.46 -4.52 605
4561.72  7977.18  264.1  9  6.93   .09  -.33 606
4399.31  9051.15     .5  2 -4.77 -3.15 -1.91 607
3996.69  7826.42  147.9 10  9.54  3.72 -3.27 608
4229.24  8112.06  232.8  4  3.88    .7 -2.51 609
3971.68  8229.49   29.9  6    .6  3.66 -1.02 610
4148.09   8753.8  347.9  9  6.82   .99  3.67 611
4693.01 10041.59     27  8  1.99 -2.43   .75 612
5004.88 10633.02   18.2  6  3.49  1.63  1.36 613
4744.98 10079.22   44.9 11   .46  2.66 -1.72 614
4850.35 10232.45    1.6  2   2.9  -.57 -2.45 615
4698.43  9297.29   69.4 12 -1.27   -.6 -2.16 616
4585.34  8634.17  118.8 11 -1.75   .15  -.48 617
4830.95  9188.63   44.3  4 -2.35 -1.32  -.83 618
4552.32  8951.46   82.3 10 -5.99 -3.18 -2.42 619
3850.19  8121.67    107 10 -7.59 -3.69 -1.63 620
3658.21  7461.76   30.5  2 11.35  3.48   .13 621
4023.99  7973.59      0  1  -.28  -.24  -.33 622
4127.81  8292.75   20.2  6   .74  -.38  1.73 623
 4505.5  8913.74  106.8  7  5.05   2.1  -.99 624
5034.02  9706.14    1.2  1  4.42 -1.69   .32 625
5262.75 10241.95   19.9  3  3.11  -.51  1.19 626
5644.58 11239.98   17.5  9  -.85  -.51   -.8 627
5869.08 11103.19   27.2  4 -6.19  -.03  -.78 628
5138.61  9887.55   54.5  8  3.89   .94   .63 629
5638.88 10998.92   22.4  4   .79 -2.68  -.07 630
5711.57 11113.67  141.2 10  2.55   .43  1.21 631
5753.53 11228.86   73.3  7  2.73   .65  1.53 632
6012.56 11449.94   57.1  7 -1.76  -.82  3.68 633
5378.97 11238.76    2.9  2   .78   .31  -.94 634
5122.04 10878.74   55.5  6  1.18  1.88  3.52 635
5342.26 11353.75   72.7 17  5.57   .55   .91 636
5749.13 11752.73   84.5  9  1.29  -.36   .07 637
5706.36 11839.72   29.2  7  4.03   .85   -.2 638
5749.17 12354.93  340.2  5  1.55 -2.29   .55 639
5648.66 12532.24  184.8 12   2.8  1.99  2.65 640
6203.57 13732.54   81.5  8  -1.2  1.35  -.02 641
6377.91 13944.94   96.7 18  5.65  1.81   .58 642
6829.73 14922.71   44.5 11 -2.71  -.03 -2.67 643
6407.92 13946.57  250.2 12  3.77  2.65 -1.19 644
6421.13 14085.76  371.7 11  4.18 -1.49   1.2 645
6394.71 14486.37     79  8  3.13  1.33   .31 646
6592.43 15105.04   24.2  7  2.81  -.58  -.05 647
7090.19 15522.15   22.2  9 -3.32   .58 -2.02 648
 6917.3 15190.51    116 16  4.65   .11  -.37 649
7147.36  15885.6    250 16   .43 -1.13  4.91 650
7730.39 17131.66  520.6 21  -.19 -4.13  1.11 651
7118.69 17086.91  141.9  6  2.06 -1.91  -.12 652
7326.22 17710.65 3575.2 10  2.61  3.09  -.68 653
7645.59  18275.7  693.6 21 -2.04 -4.27  -.02 654
7060.73 17454.13    237  6  4.24    .3  -.58 655
7229.44 17956.65  109.7  9 -1.97 -3.75 -1.31 656
7190.71 17893.82  126.7 19  2.52   3.8 -1.82 657
7337.89 18630.38  142.6 10  2.55 -2.29 -2.87 658
7220.64 18910.31 1981.1 19  -.06  2.86  2.18 659
7579.24 19261.67   91.5 12 -3.11  -.88  -3.5 660
7008.21 18555.43  148.2 16  6.14   .23 -1.89 661
7531.75 19646.98  184.8 13 -1.12  3.04  -.43 662
7563.14 19077.56 1353.8 17   .59 -3.05  1.84 663
7543.52 19519.66  358.2 20  1.36   .81 -1.19 664
7735.85 19955.62  563.3 13 -1.53  2.86  -.76 665
8105.16 20265.43  525.8 22  1.54 -4.51 -4.19 666
7962.96 20621.52  467.2  8 -6.04   .39  2.63 667
7025.39 18275.45  547.4 22 -3.07 -2.77   .51 668
7085.05 18436.73 3905.9 25  7.75 -2.18  -.21 669
7516.55 19658.92  355.2 14   .56  3.37  -.53 670
 7803.8 20104.34   33.6 10 -2.17    -3 -2.52 671
 7571.5 19617.16  171.1 22 -5.77 -3.41  1.98 672
6466.11 18022.09   73.8 16  -.08   .98  -.56 673
6756.25 17720.34  245.3 20  6.96  1.08  1.06 674
end
format %tm monthly_date
The formula for generating the monthly growth of returns I use this formular

Code:
gen ret1 = ((us000 - us000[_n-1]) / us000[_n-1])
Maybe constructing a Portfolio of all total returns per month might be a better solution but I also wanted to look at each stock independenly when I do my regression later on