by ... : sort and xtreg. "not sorted" error

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


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.