I have a problem in which I cannot solve, I tried a number of things and I have tried to search throughout the forum, but I don't seem to find what I am looking for.
I have the below data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long gvkey str24 datafqtr double atq float(ffoq2019 ffoq2020) 125721 "2018Q4" 1481.257 90.523 98.62 125721 "2019Q1" 1295.712 49.836 98.62 125721 "2019Q2" 1276.471 49.836 98.62 125721 "2019Q4" 1265.511 90.523 98.62 125721 "2020Q1" 1403.435 90.523 41.739 125721 "2020Q2" 1384.162 90.523 41.739 194943 "2018Q4" 1153.364 17.033 20.299 194943 "2019Q1" 1123.707 10.75 20.299 194943 "2019Q1" 1153.915 10.75 20.299 194943 "2019Q2" 1197.908 10.75 20.299 194943 "2019Q4" 390.61 17.033 20.299 194943 "2020Q1" 394.96 17.033 7.484 194943 "2020Q2" 385.602 17.033 7.484 end
ROA 2019
What I want is to be able to divide ffoq2019 in "2019Q2" with atq in "2018Q4" for all the different gvkeys that I have.
So i.e I want for gvkey 125721 the following output: 49.836 / 1481.257 = 0.034
ROA 2020
What I want is to be able to divide ffoq2020 in "2020Q2" with atq in "2019Q4" for all the different gvkeys that I have.
So i.e I want for gvkey 125721 the following output: 41.739 / 1265.511 = 0.033
I hope the problem is clear, if not please feel free to write your questions.
Thank you in advance.
Best regards,
Jeppe S.
0 Response to Dividing variables across time periods
Post a Comment