This is what my data looks like for one particular stock with the id 10104 (id variable is PERMNO):

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double PERMNO float(Month TotalAssets BondRatio Profitability return)
10104 698      .        .          .  -.09709885
10104 699      .        .          . -.001748674
10104 700 137264 .9235423  .06649959   .02299109
10104 701      .        .          .  -.05693493
10104 702      .        .          .   .08216067
10104 703 128358 .9631029  .05863289   .01887587
10104 704      .        .          .    .0613421
10104 705      .        .          .   -.0527541
10104 706 118318  .964613 .066253655 -.001638039
10104 707      .        .          .  -.07403603
10104 708      .        .          .    .1125138
10104 709 109438 .9612743   .0728449   .03782603
10104 710      .        .          .  .030308805
10104 711      .        .          .   .03016203
10104 712 108709 .9611375  .08650618  -.08548713
10104 713      .        .          .   .12588939
10104 714      .        .          .  -.01176061
10104 715 106229 .9240577 .071515314   -.0753108
10104 716      .        .          .   .05704951
10104 717      .        .          . -.009812777
10104 718  98443        .   .0803206  .030280743
10104 719      .        .          .  -.05628785
10104 720      .        .          . -.010003767
10104 721      .        .          .  -.05700669
10104 722      .        .          . -.022846727
10104 723      .        .          .   .09600659
10104 724      .        .          .  .015102864
10104 725      .        .          .   .02789659
10104 726      .        .          . .0032567314
10104 727      .        .          .  .031920634
end
format %tm Month

Firstly, I would have to calculate the cumulative returns from Dec2019 (=month 719) to all subsequent months:
-Dec2019 to Jan2020 = (1+r_dec19)*(1+r_jan20) - 1
-Dec2019 to Feb2020 = (1+r_dec19)*(1+r_jan20)*(1+r_feb20) - 1
-Dec2019 to Mar2020 = (1+r_dec19)*(1+r_jan20)*(1+r_feb20)*(1+r_mar20) - 1
-...
-Dec2019 to Aug2020

Where r_dec19 is the value of the return variable in month 719

Then, I want to perform multiple regressions, one for each set of calculated cumulative returns (so 8 total), using the last available values for the variables "TotalAssets", "BondRatio" and "Profitability" for each individual stock.

So regression 1 will be using the values of the cumulative returns of Dec2019 to Jan2020, regression 2 will be using the values of the cumulative returns of Dec2019 to Feb2020, etc.

To clarify, for stock 10104, the values used for each variable would be:
TotalAssets = 98443
BondRatio = 0.9240577
Profitability = 0.0803206


Once that is done, I would also like to regress each of the cumulative returns on the average of all data available for the variables "TotalAssets", "BondRatio" and "Profitability" for each individual stock (so 8 more regressions).

Any and all help will be greatly appreciated! Thank you