PDA

View Full Version : by ... : sort and xtreg. "not sorted" error



plotz
05-19-2011, 11:07 AM
Hi everyone!

I've got another problem coming on. I am currently running RE / FE regressions on a longitudinal data set using xtreg. Now I wanted to implement a sample split using values below and above the median of a variable. Furthermore, I already created a dummy called "large" for this to work. Now, in case I want to run a regression using the "by" command, Stata 11 returns an error message. Just take a look at this, please:


. sort large

. by large: xtreg inten2 L.historicalaspiration L.socialaspiration availslack unabsslack potenslack sizeindicator mainten D* Y*


-------------------------------------------------------------------------------------------------------------------------
-> large = 0
not sorted
r(5);

In case I use xtreg with the "if large == 1" suffix, the same thing happens.

How can I get this to work properly for me?

I'd be grateful for any solutions - many thanks in advance!

plotz
05-20-2011, 05:55 AM
Nevermind. Today, it seems to be working just fine. Strange fruit.

Carlos Nakashima
08-29-2011, 10:31 AM
Hi,

I'm having the same problem.
How did you fix it?

Thank you!

bukharin
08-29-2011, 06:25 PM
I would suggest using the if suffix, eg:
xtreg y x1 x2 x3 ... if ..., options

Unfortunately plotz didn't give enough information in the original post to show why this was causing a problem. If this doesn't work for you, please post the code and result that you're getting.