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 on April 23, and its replacement, is already up and running.

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

st: Simple and weird error

From   Zhangqunzi <>
To   Stats <>
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:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index