PROC NLIN may report invalid coding error and invalid sequence of command errors


When using PROC NLIN under the following four conditions:

  1. PDATA= data set
  2. BY statement
  3. OUTPUT statement
  4. Variables exist in the input data set that are not used in the analysis

then the SAS LOG will report the following errors:

ERROR: INTERNAL CODING ERROR Attempt to define a new variable number 2 on file WORK.NEW.DATA. Xvfind()or xvname() has been called for an undefined variable after variable selection had been terminated via xvsele().
ERROR: Invalid sequence of commands for file WORK.PREDICTOUT.DATA
.

To prevent this problem from occurring, drop all variables not used in the analysis using the drop sub-option on the DATA= option in the PROC NLIN statement:

data=yourdata(drop=variable1 variable2 variable3)

Dropping the unused variables allows the use of the PDATA= option, BY-group processing, and the OUTPUT statement.