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]

Re: st: complex panel data variable generation question

From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: complex panel data variable generation question
Date   Thu, 1 Sep 2011 18:33:29 +0100

It sounds as if you need to get your observations into the right order.

bysort i epoch (t) : gen last = _n == _N
bysort i (last t) : gen diff = x - x[_n-1] if last

On Thu, Sep 1, 2011 at 5:28 PM, Hoffman, George <[email protected]> wrote:
> I have a panel dataset of observations in individuals (i=1-15) over time (t=1-4000)
> The observations are sequential by minute, but the duration of observation for each individual is not identical.
> I have xtdes, i(i) t(t)
> Within the observation period are epochs (1-8) defined by events that do not occur at identical intervals but do occur sequentially.
> In additional to the observations that occur at minute intervals are measurements made only at the end of each epoch.
> What I would like to do is generate a difference between the measures made once per epoch, but since these observations do not occur at regular intervals I can't get his to work (using sorting, by i: gen...)
*   For searches and help try:

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