I need help adding a constraint to the below model that restricts the sum of "buy" for even numbered adwords to be at most 10.
proc optmodel;
set ADWORDS = 1..100;
num cost_per_click{ADWORDS} = ranuni(123);
num clicks{ADWORDS} = ranuni(567);
num conversions{ADWORDS} = ranuni(789);
num revperconversion=10;
var buy{ADWORDS} >=0;
max effectiveness =sum{a in ADWORDS}((revperconversion*conversions[a])-(clicks[a]*cost_per_click[a]))*buy[a];
con buyAtMost50: sum{a in ADWORDS}buy[a]<=50;
solve;
Quit;
Here are two ways:
con buyAtMost10even: sum {a in ADWORDS: mod(a,2) = 0} buy[a] <= 10;
con buyAtMost10even: sum {a in 2..100 by 2} buy[a] <= 10;
Here are two ways:
con buyAtMost10even: sum {a in ADWORDS: mod(a,2) = 0} buy[a] <= 10;
con buyAtMost10even: sum {a in 2..100 by 2} buy[a] <= 10;
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.
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.