Dear all,

I am currently writing my thesis for which I need some help. I have a panel-data data setup, however, first I need to run a time series regression by country (C_ID) with Newey-West SE (as previously performed tests indicated that Newey-West Standard errors would solve my problems of aut-correlation and heteroskedasticity).
So far, I have been unable to formulate a command that runs the said regressions.
This is the command:
Code:
bysort C_ID :  newey chgn10y2d chgnCESI chng10y_L1 AnnQE AnnTa, lag(12) force
I receive the message
Code:
C_ID = 2
not sorted
If it helps, this is part of the data I am dealing with:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte C_ID int Date float(chgn10y2d chng10y_L1 chgnCESI AnnQE AnnTa)
16 18392 -1.742   .097    .6 0 0
17 20074  -2.73   3.04     0 0 0
16 19025 -1.848  -.913    .7 0 0
17 17911   .141  -.563  -1.5 0 0
17 18338  -.221  -.047    .5 0 0
16 18830  -.134   -.38  -8.8 0 0
16 18847  -.436  -.276  -3.2 0 0
16 18967  -.698  -.595  13.5 0 0
16 18927  -.517  -.057   7.3 0 0
17 18035   .097   .085   4.4 0 0
16 19033 -1.686   .134    -2 0 0
20 19211   -.28    .02    .7 0 0
17 17986 -1.762   .006   4.6 0 0
16 19085   .326   .087   2.6 0 0
16 19023 -1.847  2.076  -3.7 0 0
16 19166  -.553  -.285  -1.5 0 0
16 19026 -1.338  -.474    .9 0 0
16 19135    .04   .076   -.7 0 0
14 20909  -.285    .09  -2.2 0 0
16 19002  -.467  -.066     3 0 0
16 19016    .29  -.158    .3 0 0
16 18829  -.831  -.874    .6 0 0
16 19079  -.987  -.411    .6 0 0
16 18828 -1.254   .083  -2.1 0 0
16 19059   .026   .076  -6.3 0 0
16 19075  -.379   .049  19.4 0 0
17 20103  -1.03   -.63  -1.4 0 0
17 17924  -.636  -.183    .6 0 0
16 19215   .249  -.119   -.6 0 0
14 20564   .117  -.122    .2 0 0
14 20949  -.074   .304   -.4 0 0
14 20824  -.332  -.062     0 0 0
16 19164  -.194  -.173  -2.8 1 0
16 19324  -.292   .162    .2 0 0
17 17969  -1.13  -.585   5.5 0 0
16 19142  -.644   .324    .4 0 0
12 18330   -.01    .02    .4 0 0
16 19121   .257    .11   4.9 0 0
16 19087   .358   .157     2 0 0
16 19213  -.064  -.345   -.1 0 0
16 19064  -.019  -.024  -1.7 0 0
14 20929  -.019  -.225   -.3 0 0
14 20502  -.084  -.072    .7 0 0
16 19106   .006  -.392   -22 0 0
16 19211  -.854  -.206    .7 0 0
14 20955  -.049   .018   -.5 0 0
19 18423   .015   -.01  10.7 0 0
16 19110  -.152  -.402   9.7 0 0
12 18063   -.07    .07   4.2 0 0
14 20569   .027  -.014   1.3 0 0
10 18847  -.967  -.107  -3.2 0 0
14 20467   .061   .098    .1 0 0
14 20934  -.095  -.073   2.1 0 0
16 19001  -.316  -.168  -1.4 0 0
20 18847  -.982  -.242  -3.2 0 0
16 19222  -.273  -.031   1.7 0 0
14 20577  -.451   .096  -2.3 0 0
16 18807  -.504  -.283   -.2 0 0
14 20242   .002    .01   -.5 0 0
16 18835  -.527  -.005  -1.7 0 0
16 18820   -.54   .281  -1.3 0 0
20 19173   -.56    .05   1.9 0 0
14 21481    -.2  -.189    .1 0 0
16 19115   .081   .057 -18.6 0 0
24 18837   -.06    .01   -.6 0 0
20 18966   -.46   -.08  -2.5 0 0
17 18275 -1.265  1.021   7.4 0 0
16 19243  -.346  -.461   4.1 0 0
20 19200   -.68   -.12   4.8 0 0
14 20543   .163  -.411    .7 0 0
14 20220   .024  -.017  -2.2 0 0
17 18037  -.095   .096    .5 0 0
16 18995  -.133   .038     . 0 0
14 20222  -.035   .017   -.1 0 0
16 18948  -.027  -.001   2.1 0 0
10 21335  -.315   -.05   4.2 0 0
10 19176  -.166  -.378   6.1 0 0
17 17954 -1.042  -.972   -.6 0 0
16 18939  -.317   .034   2.3 0 0
14 20258      0   .006    .5 0 0
16 19095   .069   .064  -1.6 0 0
14 20369  -.006    .01   -.3 0 0
14 20277   .025  -.045    .7 0 0
14 20290    .03  -.008    .7 0 0
16 19192    .05  -.031   1.4 0 0
24 18843   -.11   -.13    .7 0 0
14 20249   .021   .027    -1 0 0
17 17962   .806  -.751  -3.3 0 0
14 21146   .001   .107   -.5 0 0
14 20787  -.507   .358   -.8 0 0
20 18392  -.418  -.044    .6 0 0
16 19036  -.095 -1.361   1.5 0 0
14 20795  -.722   .021    .4 0 0
16 18581   -.19   -.38   1.1 0 0
16 18844  -.691  -.057  -5.7 0 0
14 20557  -.358   .032   1.8 0 0
14 20485  -.021  -.054  -6.1 0 0
16 19080   .119  -.884   2.5 0 0
16 19152   -.72  -.289   -.9 0 0
16 18763   -.21   .123    11 0 0
end
format %td Date
I have searched the whole forum and the internet without any luck. Could someone help me with this issue?

Any hint is appreciated.

Thank you very much!

Best
Nick