my Data looks like the following:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float date_b double return 1 .0065239365212619305 2 .00994880497455597 3 .005820886231958866 4 -.00029673014068976045 5 .011280903592705727 6 .010714859701693058 7 .008568055927753448 8 -.0034556929022073746 9 -.09695129841566086 10 -.008960021659731865 11 .026638707146048546 12 .011479784734547138 13 .01912318728864193 14 -.010831528343260288 15 -.004780962131917477 16 -.006353572476655245 17 -.015127903781831265 18 -.020585954189300537 19 .013581248000264168 20 -.012282668612897396 21 .013888899236917496 22 .00955722015351057 23 .0022088889963924885 24 .02629096247255802 25 .0006136050797067583 26 .007665184326469898 27 .006085407920181751 28 .0028731657657772303 29 -.0009046676568686962 30 .0007545339758507907 31 -.002714527305215597 32 -.017541147768497467 33 -.022318003699183464 34 -.011492435820400715 35 .003981525544077158 36 -.003965735901147127 37 -.025322506204247475 38 .012745077721774578 39 -.013552761636674404 40 .00245341076515615 end format %tbCalendar date_b
Code:
gen returnD2 = F2.return
I could now do the following
Code:
gen return_cum_week1 = ((returnD1+1)*(returnD2+1)*(returnD3+1)*(returnD4+1)*(returnD5+1)*(returnD6+1)*(returnD7+1)-1)
Is there any other, smarter possibility to do what I intend to do?
Thank you!
Best regards,
Eva
0 Response to Creation of cumulative lead variable
Post a Comment