Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: gen lag variable

From   Kit Baum <>
Subject   st: Re: gen lag variable
Date   Thu, 3 Aug 2006 08:52:17 -0400

tsset company year
gen lagroa = L.roa

There are many good reasons to avoid the use of [_n-1] in favor of Stata's time series operators: L., D., F., etc.

Kit Baum, Boston College Economics
An Introduction to Modern Econometrics Using Stata:

On Aug 3, 2006, at 2:33 AM, statalist-digest wrote:

I have a panel data for 1200 firms by year (10 years for each firm)
I need to create a lagged variable of one called roa but it must be lagged
for each firm
I tried with
by empresa: egen lagroa= roa[_n-1]
but the command give me this error: r(198)
What can I do?
*   For searches and help try:

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