If an assignment statement includes two or more terms involving the same lagging function with the same argument, and one of the terms is a nested expression, then the results of the optimization may be incorrect. For example, the following assignment statement causes the optimization algorithm to return incorrect results because LAG(X2) appears in two terms, including one that is a nested expression:
y = b1*x1*lag(x2) + b2*lag(x1*lag(x2));
The following lagging functions may return an incorrect result under the conditions described above: LAG(), ZLAG(), DIF(), ZDIF(), XLAG(), VLAG(), and MOVAVG(). The procedures in which this problem may be encountered are PROCs NLIN, NLMIXED and GLIMMIX in the SAS/STAT product, and PROC MODEL in the SAS/ETS product.
To circumvent the problem, either break apart the nested expression or create a temporary variable to use in the nested expression. The two circumventions are illustrated below:
y = b1*x1*lag(x2) + b2*lag(x1)*lag2(x2);
or
lag_x2 = lag(x2);
y = b1*x1*lag_x2 + b2*lag(x1*lag_x2);