The NLP Procedure

Program Statements

This section lists the program statements used to code the objective function and nonlinear constraints and their derivatives, and it documents the differences between program statements in the NLP procedure and program statements in the DATA step. The syntax of program statements used in PROC NLP is identical to that used in the CALIS, GENMOD, and MODEL procedures (refer to the SAS/ETS User's Guide).

Most of the program statements which can be used in the SAS DATA step can also be used in the NLP procedure. See the SAS Language Guide or base SAS documentation for a description of the SAS program statements.


ABORT;
CALL name [ ( expression [, expression ... ] ) ];
DELETE;
DO [ variable = expression
            [ TO expression ] [ BY expression ]
            [, expression [ TO expression ] [ BY expression ] ... ]
    ]
    [ WHILE expression ] [ UNTIL expression ];
END;
GOTO statement_label;
IF expression;
IF expression THEN program_statement;
    ELSE program_statement;
variable = expression;
variable + expression;
LINK statement_label;
PUT [ variable] [=] [...] ;
RETURN;
SELECT [( expression )];
STOP;
SUBSTR( variable, index, length ) = expression;
WHEN ( expression) program_statement;
    OTHERWISE program_statement;

For the most part, the SAS program statements work as they do in the SAS DATA step as documented in the SAS Language Guide. However, there are several differences that should be noted.

do i = 1,2,3;

is supported; however,

do i = 'A','B','C';

is not.

  • The PUT statement, used mostly for program debugging in PROC NLP, supports only some of the features of the DATA step PUT statement, and has some new features that the DATA step PUT statement does not:
    • The PROC NLP PUT statement does not support line pointers, factored lists, iteration factors, overprinting, _INFILE_, the colon (:) format modifier, or "$".
    • The PROC NLP PUT statement does support expressions, but the expression must be enclosed inside of parentheses. For example, the following statement displays the square root of x:   put (sqrt(x));
    • The PROC NLP PUT statement supports the print item _PDV_ to print a formatted listing of all variables in the program. For example, the following statement displays a more readable listing of the variables than the _all_ print item:   put _pdv_;
  • The WHEN and OTHERWISE statements allow more than one target statement. That is, DO/END groups are not necessary for multiple statement WHENs. For example, the following syntax is valid:

    SELECT; 
    WHEN ( exp1 )stmt1;
     stmt2;
    WHEN ( exp2 )stmt3;
     stmt4;
    END; 

  • It is recommended to keep some kind of order in the input of NLP, that is, between the statements that define decision variables and constraints and the program code used to specify objective functions and derivatives.

    Use of Special Variables in Program Code

    Except for the quadratic programming techniques (QUADAS and LICOMP) that do not execute program statements during the iteration process, several special variables in the program code can be used to communicate with PROC NLP in special situations:

    Previous Page | Next Page | Top of Page