## Constrained regression using nlin not working

Simple regression with proc nlin not working. I'm getting

ERROR: The variable p11 in the BOUNDS statement is not a parameter.

The afftected code is:  P11 = coeff_11 + .25

1 row of sample data:

User pin  cat_1  cat_2 ....cat_12  dwpi_hours

234gu         4         5  ...         5           234.4

``````proc nlin data=work.work1 method=gradient;
parms
ccoeff_1= .3
coeff_2= .3
coeff_3= .3
coeff_4= .3
coeff_5= .3
coeff_6= .3
coeff_7= .3
coeff_8= .3
coeff_9= .3
coeff_10= .3
coeff_11= .3
coeff_12= .3
int= -100;

p1 = coeff_1 + .25;
p2 = coeff_2 + .25;
p3 = coeff_3 + .25;
p4 = coeff_4 + .25;
p5 = coeff_5 + .25;
p6 = coeff_6 + .25;
p7 = coeff_7 + .25;
p8 = coeff_8 + .25;
p9 = coeff_9 + .25;
p10 = coeff_10 + .25;
p11 = coeff_11 + .25;

bounds 3 <= coeff_1-coeff_12 <= 16;
bounds -1000000 < int < 1000000;
bounds coeff_2 >= p1;
bounds coeff_3 >= p2;
bounds coeff_4 >= p3;
bounds coeff_5 >= p4;
bounds coeff_6 >= p5;
bounds coeff_7 >= p6;
bounds coeff_8 >= p7;
bounds coeff_9 >= p8;
bounds coeff_10 >= p9;
bounds coeff_11 >= p10;
bounds coeff_12 >= p11;

model dwpi_hours = cat_1 *(-.25+p1) + cat_2 *(-.25+p2) + cat_3 *(-.25+p3) + cat_4 *(-.25+p4) + cat_5 *(-.25+p5) + cat_6 *(-.25+p6) +
cat_7 *(-.25+p7) + cat_8 *(-.25+p8) + cat_9 *(-.25+p9) + cat_10 *(-.25+p10) + cat_11 *(-.25+p11) + cat_12 *coeff_12 + int;
run;``````

Here's the log output:

NOTE: DER.coeff_1 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_2 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_3 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_4 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_5 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_6 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_7 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_8 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_9 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_10 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_11 not initialized or missing. It will be computed automatically.

NOTE: DER.coeff_12 not initialized or missing. It will be computed automatically.

NOTE: DER.int not initialized or missing. It will be computed automatically.

ERROR: The variable p11 in the BOUNDS statement is not a parameter.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE NLIN used (Total process time):

real time 0.14 seconds

cpu time 0.07 seconds

83

84

85 GOPTIONS NOACCESSIBLE;

87 %LET _CLIENTPROCESSFLOWNAME=;

88 %LET _CLIENTPROJECTPATH=;

89 %LET _CLIENTPROJECTPATHHOST=;

90 %LET _CLIENTPROJECTNAME=;

91 %LET _SASPROGRAMFILE=;

92 %LET _SASPROGRAMFILEHOST=;

93

3 The SAS System 11:37 Thursday, March 28, 2019

94 ;*';*";*/;quit;run;

95 ODS _ALL_ CLOSE;

96

97

98 QUIT; RUN;

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Constrained regression using nlin not working

I solved this problem using proc optmodel. For constrained regression with unlimited number and types of constraints, it's the way to go.

6 REPLIES 6

## Re: Constrained regression using nlin not working

When dealing with an error it is best to copy the code with ALL of the messages for a procedure from the log. Paste them into a code box opened using the forum's {I} icon in the message window.

Typically one or both of those errors place a diagnostic _ character under the position that SAS determined the error occurred. Pasting into a code box will preserve the formatting of the error messages as other wise the message windows here will reformat the log entry so that those characters appear at the beginning of a line and not in relationship to the code.

## Re: Constrained regression using nlin not working

I don't follow what you're saying.

To attempt to fix my problem, I moved the p1-p11 outside of the parm statement and think I made them temp variables; I've updated the original post with the current version of the code. Now SAS is saying "the variable p11 in the BOUNDS statement is not a parameter."

This all started from me wanting to have this constraint:  "coeff_4 >= coeff_3 + .25"; the nlin book I found online said I need to parametrize and do it the way I did it. This is my attempt to do that. I'm able to do all this in Excel using Solver but it's slow; I was hoping SAS could speed it up a little. This is crazy; SAS syntax is horrible.

## Re: Constrained regression using nlin not working

Post the lines from the log of the code you are submitting with the error messages.

You may also have to provide example data.

## Re: Constrained regression using nlin not working

Please provide a link to "the nlin book I found online" so that we can see what reference you are using.

## Re: Constrained regression using nlin not working

I solved this problem using proc optmodel. For constrained regression with unlimited number and types of constraints, it's the way to go.

## Re: Constrained regression using nlin not working

Glad to hear. I would still appreciate a link to the NLIN book or web site that you were looking at earlier.

Discussion stats
• 6 replies
• 999 views
• 0 likes
• 3 in conversation