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
syntax of forecast errorHi all, I am currently working on a state-dependent fiscal multiplier using forecast error to ident…
Efficiently creating lags only for certain yearsHi, I am working with election data and have two datasets (concerned variables explained below): D…
Endogeneity in panel dataHi everyone, I have a balanced panel data N=14 (country) T=5. I have developed a Correlated random-e…
Program to label variables from list of words - How to use fewer single and double quotesI am used to make reusable programs, and find myself having issues with how I use the local single q…
Questions about components' stationarity in VAR model.I am very confused about the stationarity of variables in VAR. It seems that different econometrics …
Subscribe to:
Post Comments (Atom)
0 Response to Returns of different companies
Post a Comment