Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Simple and weird error


From   Zhangqunzi <zhangqunzi@googlemail.com>
To   Stats <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index