Hello Statalist,
I have daily panel data which consist of 10 companies for the period 2004-2014.
The data as following.
Here, I would like to generate daily market returns which computed as the value-weighted average of the returns of all individual stocks on a given day.
Before this, I simply use the command;
code
But, It seems wrong as it did not take into account the Market value as a weight. How can I instruct Stata to use market value as a weight? The market value used is at the beginning of each year.
Thank you in advance for your kind help.
Regards,
Rozita
I have daily panel data which consist of 10 companies for the period 2004-2014.
The data as following.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float idc str21 company double _marketvalue float(bcaldate return_tr) 1 "ALUAR" 4422 0 . 1 "ALUAR" 4395.6 1 -1.0000079 1 "ALUAR" 4461.6 2 . 1 "ALUAR" 4474.8 3 .4938291 1 "ALUAR" 4554 4 1.951283 1 "ALUAR" 4593.59 5 .4819319 1 "ALUAR" 4593.59 6 3.667978e-06 1 "ALUAR" 4593.59 7 3.667978e-06 1 "ALUAR" 4580.39 8 3.667978e-06 1 "ALUAR" 4540.8 9 . 1 "ALUAR" 4501.2 10 . 1 "ALUAR" 4593.59 11 . 1 "ALUAR" 4686 12 2.3754122 1 "ALUAR" 4686 13 -5.372813e-06 1 "ALUAR" 4593.59 14 . 1 "ALUAR" 4593.59 15 . 1 "ALUAR" 4540.8 16 . 1 "ALUAR" 4501.2 17 . 1 "ALUAR" 4554 18 . 1 "ALUAR" 4620 19 1.438877 end format %tbmybcal bcaldate
Here, I would like to generate daily market returns which computed as the value-weighted average of the returns of all individual stocks on a given day.
Before this, I simply use the command;
code
Code:
egen marketreturn = mean(return_tr)
Thank you in advance for your kind help.
Regards,
Rozita
Comment