I have a example stata file in this link: http://yunpan.cn/cLVEmBxX6RZYZ Password:90fa
I want to caluculate the market value weighted price in Stata and I have already thought about some codes, but I still do not know how to get my result. This is my code.
egen company=group(ISINnumber)
sum company
local c=r(max)
gen PM=Aprice*Amarketvalue
forvalues i=1/1303 {
forvalues n=1/`c' {
local PMprice`n'`i'=PM if company==`n' & week==`i'
}
}