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]

st: 'XTSUR' with lagged indepvar - how to sort the data?


From   Daniel Schultheis <[email protected]>
To   [email protected]
Subject   st: 'XTSUR' with lagged indepvar - how to sort the data?
Date   Wed, 3 Jul 2013 00:51:25 +0200

Dear Statalisters,

I have a question concerning the 'xtsur'- command for unbalanced
panels in Stata and cannot find the answer anywhere on the web (the
question itself I found several times :-)).

I am trying to use the 'xtsur' command with lagged independent variables in
my panel in Stata version 12.1. For the lagged effect, I used the time
series operators 'L.indepvar', 'L2.indepvar', ... , so I did not
create a new variable.

The panel is set with 'xtset' and and the data is sorted according
to the panel-variable "ID" and the time-variable "Date2". 'xtsur'
without lagged variables works perfectly fine. If I want to use xtsur
with the lagged indepenendent variable, the following error message
occurs:

not sorted
               st_data():  3598  Stata returned error
              _xtsurub():     -  function returned error
                 <istmt>:     -  function returned error.

I tried to sort the data in descending order via 'gsort ID -Date2',
but the same error message occured.

Is there any possibility to sort or arrange my data so that I can use the
'xtsur' command to show the lagged effect via 'xtsur'?

Thank you so much for your help, it is very appreciated.

Best regards from Munich,
Daniel
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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