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
mi impute for two variablesHi, I am trying to impute two separate variables. When trying to determine an appropriate imputatio…
Plausible values: what do i do?Hi, i have found nearly nothing on this. It is used mostly on PISA, TIMMS and PIRLS testing. I kind …
Displaying the number of observationsDear statalist, While running a logistic regression, is it possible to display the number of observ…
probability estimation using -margins- from zero cell in cross tabulationDear statalisters, I would like to ask you please some help interpreting margins I use Stata 14. W…
"command tsset is unrecognized" Error 199Hi, since this is my first post/question I would like to apologize in advance if this is the wrong f…
Subscribe to:
Post Comments (Atom)
0 Response to Returns of different companies
Post a Comment