Bookmark and Share

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

[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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index