The NLMOD Procedure

Programming Statements

Programming statements define the arguments of the MODEL, ESTIMATE, and PREDICT statements in PROC NLMOD. Most of the programming statements that you can use in the SAS DATA step can also be used in the NLMOD procedure. For a description of SAS programming statements, see SAS Language Reference: Concepts. You can use the following programming 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, these SAS programming statements work the same as they do in the SAS DATA step, as documented in SAS Language Reference: Concepts. However, they differ as follows:

  • The ABORT statement does not allow any arguments.

  • The DO statement does not allow a character index variable. Thus, PROC NLMOD supports the first of the following statements, but not the second:

    do i = 1,2,3;
    
    do i = 'A','B','C';
    

  • In contrast to other procedures that share PROC NLMOD’s programming syntax, PROC NLMOD does not support the LAG function. Because observations are not processed sequentially when high-performance analytical procedures perform the parameter optimization, information for computing lagged values is not available.

  • The PUT statement, used mostly for program debugging in PROC NLMOD, supports only some of the features of the DATA step PUT statement, and it has some new features that the DATA step PUT statement does not have:

    • The PROC NLMOD PUT statement does not support line pointers, factored lists, iteration factors, overprinting, _INFILE_, the colon (:) format modifier, or "$".

    • The PROC NLMOD PUT statement supports expressions, but the expression must be enclosed in parentheses. For example, the following statement displays the square root of x:

             put  (sqrt(x));
      
    • The PROC NLMOD PUT statement supports the item _PDV_, which displays a formatted listing of all variables in the program. For example, the following statement displays a much more readable listing of the variables than the _ALL_ print item:

             put _pdv_;
      
  • The WHEN and OTHERWISE statements enable you to specify more than one programming statement. That is, DO/END groups are not necessary for multiple WHEN statements. For example, the following syntax is valid:

    select;
       when (exp1) stmt1;
                   stmt2;
       when (exp2) stmt3;
                   stmt4;
    end;
    

When you write your programming statements, avoid defining variables that begin with an underscore (_), because they might conflict with internal variables that PROC NLMOD creates. The MODEL statement must follow any SAS programming statements that define or modify terms that are used to specify the model.

Last updated: February 09, 2023