The NLIN Procedure

Other Programming Statements

PROC NLIN supports many statements that are similar to SAS programming statements used in a DATA step. However, there are some differences in capabilities; for additional information, see also the section Incompatibilities with SAS 6.11 and Earlier Versions of PROC NLIN.

Several SAS programming statements can be used after the PROC NLIN statement. These statements can appear anywhere in the PROC NLIN code, but new variables must be created before they appear in other statements. For example, the following statements are valid since they create the variable temp before it is used in the MODEL statement:

proc nlin;
   parms b0=0 to 2 by 0.5 b1=0.01 to 0.09 by 0.01;
   temp = exp(-b1*x);
   model y=b0*(1-temp);
run;

The following statements result in missing values for y because the variable temp is undefined before it is used:

proc nlin;
   parms b0=0 to 2 by 0.5 b1=0.01 to 0.09 by 0.01;
   model y = b0*(1-temp);
   temp = exp(-b1*x);
run;

PROC NLIN can process assignment statements, explicitly or implicitly subscripted ARRAY statements, explicitly or implicitly subscripted array references, IF statements, SAS functions, and program control statements. You can use programming statements to create new SAS variables for the duration of the procedure. These variables are not included in the data set to which PROC NLIN is applied. Program statements can include variables in the DATA= data set, parameter names, variables created by preceding programming statements within PROC NLIN, and special variables used by PROC NLIN. The following SAS programming statements can be used in PROC NLIN:

  • ABORT;

  • ARRAY arrayname <[ dimensions ]> <$> <variables-and-constants>;

  • 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;

These statements can use the special variables created by PROC NLIN. See the section Special Variables for more information.