Bookmark and Share

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


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

RE: st: complex panel data variable generation question


From   "Hoffman, George" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: complex panel data variable generation question
Date   Thu, 1 Sep 2011 22:45:19 -0500

Nick -
Works perfectly for what I asked for (which wasn't exactly what I wanted , but close enough).
Thank you for helping me over another hurdle
George Hoffman

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Thursday, September 01, 2011 12:33 PM
To: [email protected]
Subject: Re: st: complex panel data variable generation question

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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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