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: Problem with paneldata


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: Problem with paneldata
Date   Wed, 16 Jun 2010 15:16:16 -0500

I am assuming the -gen lag_saleq- did not come immediately after
-xtset gvkey2 quartal-  because -xtset- should have sorted the data.
Perhaps, a  very brief  -list-ing of gvkey2, quartal, and saleq would
help.

Does your quartal variable have consecutive values: 5, 6, 7, ...?
If not, you will end up with all missing values in your lagged
variable (with delta = 1).  For example, note:

. webuse grunfeld,clear

. xtset ,clear

. replace time = time*2
(200 real changes made)

. xtset com time
       panel variable:  company (strongly balanced)
        time variable:  time, 2 to 40, but with gaps
                delta:  1 unit

. gen laginvest = l.invest
(200 missing values generated)

. xtset com time, delta(2)
       panel variable:  company (strongly balanced)
        time variable:  time, 2 to 40
                delta:  2 units

. gen laginvest2 = l.invest
(10 missing values generated)


Scott


On Wed, Jun 16, 2010 at 2:39 PM, Thomas Gericks <[email protected]> wrote:
> I changed the time series to quartal.
>
> it says:
>
> . xtset gvkey2 quartal
>  panel variable:  gvkey2 (unbalanced)
>  time variable:  quartal, 5 to 199, but with gaps
>  delta:  1 unit
>
> when i now try:
>
> gen lag_saleq = L.saleq
>
> it gives me the error: "Not sorted"

*
*   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