Dear All,
I am trying to calculate the log return lr
according to the code below:
For each varname of varlist 'r(varlist)'{
Quiet replace 'varname' =log('varname')
Quiet gen lr'var'='varname'[_n]-'varname'[_n-1]
Quiet drop 'varname'
}
varname is price1,2,3 etc for each firm.
In the end I found all the log return I get is positive which is clearly wrong for 5000 firms and 30years.
Can anyone help me about this? Thanks
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/