BookmarkSubscribeRSS Feed
Santha
Pyrite | Level 9
thank you. i shall use the auto as you recommended.
zamolotov
Calcite | Level 5

Hi Santha,

I've saw your code and could highlight some moment:

var BoxesNeeded {LegitCombo_ISN} >= 0 integer;
var Proportion {LegitCombo_ISN} >= 0 <= 1;
impvar VolumeInsideBox {i in ISN, b in BOX,m in MOL,d in T1,w in T2} = Volume_ISN[i] * Proportion[i,b,m,d,w];
impvar WeightInsideBox {i in ISN, b in BOX,m in MOL,d in T1,w in T2} = Weight_ISN[i] * Proportion[i,b,m,d,w];

In this case, you'll get some errors because you create variables only for certain subset with expression Flag=1.

I would recommend you to fix some values for variable, like that:

var BoxesNeeded {i in ISN, b in BOX,m in MOL,d in T1,w in T2} >= 0 integer;
var Proportion {i in ISN, b in BOX,m in MOL,d in T1,w in T2} >= 0 <= 1;

for {i in ISN, b in BOX,m in MOL,d in T1,w in T2:  Flag[i,b,m,d,w]=1 } do;
        fix BoxesNeeded {i in ISN, b in BOX,m in MOL,d in T1,w in T2}=0;
        fix Proportion {i in ISN, b in BOX,m in MOL,d in T1,w in T2}=0;
end;
In this case you can set constraint correctly. Thats should be look like that:

con CYSSpecific {m in MOL, i in ISN,d in T1: m="CYS"}:
sum {b in BOX, w in T2} VolumeInsideBox[i,b,m,d,w]= Volume_ISN[i]*Is_ISN_MOL[i,m];

Santha
Pyrite | Level 9
Pls ignore this code. I have refined my code. I have not used Flag anymore as I realized there is no need of it. I have my latest code in the latest comment of mine.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 17 replies
  • 6977 views
  • 2 likes
  • 4 in conversation