Hello, I am new in Stata.
I have stock price data of many companies. I would like to get the return by using this code gen return= price/ price[_n-1]-1, however when I perform it in my data it runs for all companies mixing them. I would like to know which code I have to use to generate this variable based on the company id since I need to get the daily returns by company. I tried this code bysort gvkey datadate: gen return= price/ price[_n-1] , but it did not solve my issue. I hope someone can help me. Thanks in advance.
(Stata 16.0)
Related Posts with Returns of different companies
Power calculations with IVHello (from a new member), Can someone guide me on how to do power calculations in stata to show th…
PkequivHi, I am using the pkequiv function to compare plasma levels between two medicinal solutions, do i n…
bootstrap with replacement - roctabHi, I am running roctab to find the ROC area. We have repeated measures - some subjects have two ob…
dummy=1 over a period when a condition satisfiesIt is tough to explain but i will try my best. "Surge" is the dummy variable i created for capital f…
Propensity score matching (psmatch2) for clustered dataHello everyone, I'm trying to implement propensity score matching (PSM) in a situation of clustered…
Subscribe to:
Post Comments (Atom)
0 Response to Returns of different companies
Post a Comment