Dear Statalist members,

I'm trying to write my dissertation and need your help -I am new to Stata.

I need to run a Probit regression on dependent variable Y (1 ; 0) using independent variable X (also 1;0). X needs to be year T-1.
I used Xtset command and set the panel and time variables (year).
The data includes different companies (identified by companyID) having each multiple years worth of data.
The way I tried to run the code was:

by CompanyID: probit Y l1.X, however I'm getting an error message that data is not sorted. I tried to sort the relevant variables without success.

Am I on the right tracks?


Thank you