Hi Statalister,

I have a problem related to cumulative returns, I have a return series from 01-01-2020 to 23-03-2020, which I have calculated the cumulative return for (cum_ret_collapse) and then I have the return from the 24-03-2020 (ret_stimulus). What I would like my final result to look like, based on the below dataex output is:

gvkey date cum_ret_collapse ret_stimulus
121572 23-03-2020 (21997) -.25781345 BLANK
121572 24-03-2020 (21998) BLANK .11871266
351629 23-03-2020 (21997) -.4168774 BLANK
351629 24-03-2020 (21998) BLANK .04898913
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long(gvkey date) float(ln_daily_excess_return cum_ret_collapse ret_stimulus)
121572 21916  -.005597397          .         .
121572 21917   .012331572          .         .
121572 21920   .014464203          .         .
121572 21921  -.030459324          .         .
121572 21922   .010714876          .         .
121572 21923   .012003983          .         .
121572 21924 -.0001912124          .         .
121572 21927    .01298292          .         .
121572 21928   .016417757          .         .
121572 21929   .017291797          .         .
121572 21930   .007254987          .         .
121572 21931  -.011881473          .         .
121572 21935 .00024433032          .         .
121572 21936  -.009300313          .         .
121572 21937   .007439621          .         .
121572 21938  -.011954164          .         .
121572 21941  .0022482078          .         .
121572 21942   -.00932446          .         .
121572 21943 -.0092616705          .         .
121572 21944  -.006548685          .         .
121572 21945   -.03011329          .         .
121572 21948  -.007227845          .         .
121572 21949  -.001198359          .         .
121572 21950    .01139212          .         .
121572 21951   .007558542          .         .
121572 21952 -.0001659268          .         .
121572 21955   -.00283801          .         .
121572 21956  -.004852127          .         .
121572 21957   .011355303          .         .
121572 21958 -.0083264755          .         .
121572 21959  -.016974656          .         .
121572 21963  -.010120523          .         .
121572 21964   -.02562303          .         .
121572 21965    .01279469          .         .
121572 21966   .006664403          .         .
121572 21969  -.015735576          .         .
121572 21970  -.008814471          .         .
121572 21971   -.00498269          .         .
121572 21972   .016218198          .         .
121572 21973  .0031807376          .         .
121572 21976  -.006490797          .         .
121572 21977   .006421153          .         .
121572 21978    .03947235          .         .
121572 21979    -.0326997          .         .
121572 21980  -.006461781          .         .
121572 21983  -.005753573          .         .
121572 21984   .005175421          .         .
121572 21985  -.014263118          .         .
121572 21986   -.03841731          .         .
121572 21987    .01693143          .         .
121572 21990   -.10546456          .         .
121572 21991  -.019903116          .         .
121572 21992   -.04505246          .         .
121572 21993    .02358914          .         .
121572 21994    -.0947519          .         .
121572 21997    .02844759 -.25781345         .
121572 21998    .11871266          . .11871266
351629 21916  -.011761626          .         .
351629 21917   .014446345          .         .
351629 21920  -.007383171          .         .
351629 21921   -.02013525          .         .
351629 21922   .009187161          .         .
351629 21923 .00020607914          .         .
351629 21924   .008115655          .         .
351629 21927   .016802315          .         .
351629 21928 -.0024659846          .         .
351629 21929  .0006855737          .         .
351629 21930   .002621368          .         .
351629 21931   .008626423          .         .
351629 21935  -.004126159          .         .
351629 21936  -.006078674          .         .
351629 21937   .002617892          .         .
351629 21938  -.011460582          .         .
351629 21941  -.005677637          .         .
351629 21942   .002656959          .         .
351629 21943  -.002004263          .         .
351629 21944    .01264292          .         .
351629 21945  -.007831172          .         .
351629 21948   .010650126          .         .
351629 21949   .002612802          .         .
351629 21950  -.002456543          .         .
351629 21951  -.002221288          .         .
351629 21952  -.005385953          .         .
351629 21955   .018053994          .         .
351629 21956 -.0014790925          .         .
351629 21957   .005449541          .         .
351629 21958   .007075593          .         .
351629 21959   .007963802          .         .
351629 21963  .0011278415          .         .
351629 21964 -.0080429055          .         .
351629 21965   .009826872          .         .
351629 21966  -.013701586          .         .
351629 21969  -.018468712          .         .
351629 21970   -.03794376          .         .
351629 21971  -.012918465          .         .
351629 21972   -.06838585          .         .
351629 21973  -.029580915          .         .
351629 21976    .04113207          .         .
351629 21977 -.0008376593          .         .
351629 21978    .05137467          .         .
351629 21979  -.025396325          .         .
351629 21980   -.02713015          .         .
351629 21983   -.11313085          .         .
351629 21984   .034961585          .         .
351629 21985   -.09721826          .         .
351629 21986   -.13892464          .         .
351629 21987     .1459414          .         .
351629 21990    -.2206053          .         .
351629 21991     .0515087          .         .
351629 21992    -.1193427          .         .
351629 21993   .014776438          .         .
351629 21994    -.0498397          .         .
351629 21997    .05151322  -.4168774         .
351629 21998    .04898913          . .04898913
end
format %td date
I have tried reading/watching videos about any ways of doing so, but I did not find anything that seemed to suit my purpose.

Does anyone have a neat trick to fix this issue?

If further questions are needed to solve this problem, feel free to ask.

Thank you in advance.

Best Regards,
Jeppe S