BookmarkSubscribeRSS Feed
FrankHonduras16
Calcite | Level 5

hello, I've been trying to resolve the next linear programming problem...but, what I only got is an error:

 

OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

proc optmodel;
ERROR: Procedure OPTMODEL not found.
 
var x1 integer =>0;
var x2 integer =>0;
 
maximize z=3*x1+5*x2;
 
con c1: 3*x1-2*x2<=10;
con c2: 5*x1+10*x2<=56;
 
solve;
 
print x1 x2;
 
quit;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDIMIENTO OPTMODEL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 
 
can you please help me..I dont know where I'm wrong. Thanks
 
franklin
3 REPLIES 3
Reeza
Super User

Are you using SAS UE? If so, I don't think proc optmodel is included. 

It falls under SAS/OR which is not part of SAS UE. 

FrankHonduras16
Calcite | Level 5

Yes I do 

Rick_SAS
SAS Super FREQ

If you are using SAS University Edition, then you have access to SAS/IML, which supports linear programming (LP) and mixed-integer LP. . Use the MILPSOLVE subroutine, as follows

 

/* Problem: x is a vector of integers 0 <= x[i] <= 10 
maximize c*x = 3*x1 + 5*x2
subject to 
A*x SYMBOL b 
where SYMBOL is a vector of symbols that indicate <=, =, or >=
*/
proc optmodel;
var x{i in 1..2} integer >= 0;
max z = 3*x[1] +  5*x[2];
con c1: 3*x[1] + -2*x[2] <= 10;
con c2: 5*x[1] + 10*x[2] <= 56;
solve with milp;
print x;
quit;

proc iml;
/* information about variables (row of column, doesn't matter) */
colType = {I, I};  /* variables are integers */
LowerB =  {0, 0};  /* lower bound contraints on x */
UpperB = {10,10};  /* upper bound contraints on x */

/* objective function */
c = {3 5};        /* vector for objective function c*x */

/* linear constraints */
A = {3 -2,        /* matrix of contraint coefficients */
     5 10};
b = {10,          /* RHS of constraint eqns (column vector) */
     56};         

/* specify symbols for constraints:
   'L' for less than or equal
   'E' for equal
   'G' for greater than or equal */
LEG = {L, L}; 

/* control vector for optimization */
ctrl = {-1,       /* maximize objective */
         1};      /* print level */

CALL MILPSOLVE(rc, objVal, result, relgap, /* output variables */
               c, A, b,      /* objective and linear constraints */
               ctrl,         /* control vector */
               coltype, LEG, /*range*/, LowerB, UpperB); 
print rc objVal relgap, result[rowname={x1 x2}];

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1760 views
  • 0 likes
  • 3 in conversation