|
I got the following back from sas technical support:
Setting up a large model in NLP is a cumbersome process. There are
very few shortcuts. Using macro code can be a good way to write out
similar groups of constraints and to write out an objective function.
You can write macro loops on the LINCON statements to express your
constraint.
Here's the code I'm trying to run:
%macro sumloop(x1:x2,port_wt);
data _null_;
Port_wt = 0;
%do i=1 %to 2;
Port_wt =port_wt + x&i;
%end;
run;
%mend sumloop;
data quad1;
input _type_ $ _name_ $ x1 x2;
datalines;
const . 0 0
quad x1 0.8 0
quad x2 0 .8
;
proc nlp inquad=quad1 all;
min ;
parms x1 x2 = -1;
bounds 0 <= x1 <= 1,
0 <= x2 <= 1;
%sumloop(x1:x2,port_wt);
LINCON 1 = &port_wt;
run;
However, the following proc nlp call does work:
proc nlp inquad=quad1 all;
min ;
parms x1 x2 = -1;
bounds 0 <= x1 <= 1,
0 <= x2 <= 1;
LINCON 1 = x1 + x2;
run;
I NEED TO PASS INTO MACRO SUMLOOP X1-X1000 AND I NEED SOMEWAY OF
CREATING THE LINCON CONSTRAINT OF
LINCON 1= X1+X2+X3+...+X1000. I'M TRYING TO FIGURE OUT HOW TO USE
MACRO CALLS WITHIN PRO NLP SO I CAN SET PARMS,BOUNDS AND CONSTRAINTS.
Will get to the objective function later. Thanks for your help
|