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]

Re: st: complex panel data variable generation question

From   Nick Cox <>
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 <> 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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index