BookmarkSubscribeRSS Feed
wutao9999
Obsidian | Level 7

proc optmodel;

var a >= 0; var b >= 0;

con     constr1:

           a + b <= 9

max    5*a + 3*b

solve ;

con constr2:

          a + b <= 12

max   3*a + 4*b

solve ;     (question: how do change the code here, such that this solve only deals with the problem defined after the previous solve?)

quit;

1 REPLY 1
RobPratt
SAS Super FREQ

The simplest approach here is to use the DROP statement (SAS/OR(R) 13.2 User's Guide: Mathematical Programming) to drop the first constraint:

drop constr1;

More generally, you can use the PROBLEM and USE PROBLEM statements to handle multiple problems within one PROC OPTMODEL session:

SAS/OR(R) 13.2 User's Guide: Mathematical Programming

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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
  • 1 reply
  • 702 views
  • 0 likes
  • 2 in conversation