1. -newey2- does not recognize time-series operators in Stata. (That
may be because -newey2- was last updated in early 2004.) The "not
sorted" error is what you seen instead. To get around this problem,
first create each lagged variable as its own series before estimating
your regressions. For example:

2. -newey- and -newey2- do not work if there are any "gaps" in your
data in time. (This should not be surprising, as it is not possible
to produce standard errors that are robust to serial correlation
without sequential observations in time.) You can get around this
problem by either using the -force- option in -newey2-, or by
constructing a linear time series for your observations in sequence
and -tsset- or -xtset- to that series. You should carefully explore
whether the statistics you get from such a procedure are meaningful,
however. (I suspect this also means you will need to work with a
balanced panel, but I leave that as an exercise.)

Below is a sample program, using a dataset made generally available
through StataCorp, that illustrates these points. Note that if you
try to run this program in its entirety, it will halt at the first
line that produces an error -- and there are several errors by the
nature of this demonstration program. I've noted with a comment
after each estimation command whether it "Works!" or, if it fails,
what error message it produces.

Fellow listers, I am trying to understand the cause of intermittent
errors

"[time series variable] is not regularly spaced" and
"not sorted"
when trying to run newey and newey2 on panel data with approximately
50 companies and 900 trade days of market variables.
I have ensured that my time variable is consecutive for all firms:
. xtset
panel variable: CompanyNum (unbalanced)
time variable: TradeDateNe~m, 1 to 902
delta: 1 unit
and while not perfectly balanced (one firm begins at
TradeDateNewNumber 23 as opposed to 1) it is much closer to balanced
than not. I can force newey to work
. newey LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock ,

lag(4) force

[output excluded placed at bottom of note for readability]
but the same command on newey2 produces not sorted:
. newey2 LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock

, lag(4) force

not sorted
I have tried sorting by time variable first as opposed to panel and
time, the default, with no effect.
Without force I nearly always get:
. newey LnRtStock LnRtSP500, lag(2)
TradeDateNewNum is not regularly spaced
If I drop the one firm I mentioned to perfectly balance the dataset:
. xtset
panel variable: CompanyNum (strongly balanced)
time variable: TradeDateNe~m, 1 to 902
delta: 1 unit
and run newey without force:
. newey LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock ,

not sorted
r(5);
The only thing I can think of is that one of my independent variables
in the regressions, LnRTCDX, is missing about 15 values over the range
of the time series.
This question was posted four years ago without a satisfactory reply
save for read the FAQ.
Can anyone help me to continue troubleshooting or to understand the
cause of these errors?
Output from original successful implementation of newey: