Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Simple and weird error


From   Zhangqunzi <[email protected]>
To   Stats <[email protected]>
Subject   st: Simple and weird error
Date   Wed, 21 Nov 2012 23:54:41 +0100

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index