I am doing Granger Causality test and I want to know about the lag selection. I am using 'forvalues' to find out the optimal lag length.

My dependent variable(Y) is 'GDP' and independent variable(X) is 'EMPLOYMENT"

When I use the 'forvalues' command, it gives a different lag length with each variable.

For example, Y → X (lag 2, based on AIC), X → Y (lag 3).

In my understanding, with each direction(Y → X, X →Y), the lag length should be the same.

Is it okay to use the command of 'varsoc'? Is it different than the command of 'forvalues?

Thanks a lot...