Hello,
how do you define a constraint for a specific set of variales (using "in" not GE or LE, etc.)? For example, instead of:
Con Cns_Ex{c in Components:c="R2"}:Sum{p in Products} X
*Qty[p,c]<=8;
I would like something similar to:
Con Cns_Ex{c in Components:c in ("R2", "R5")}:Sum{p in Products} X
*Qty[p,c]<=8
Thanks&best regards
Here are two ways (note the curly braces instead of parentheses):
Con Cns_Ex{c in Components:c in {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
Con Cns_Ex{c in Components inter {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
If you know that "R2" and "R5" are both in Components, you can make it even simpler:
Con Cns_Ex{c in {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
Here are two ways (note the curly braces instead of parentheses):
Con Cns_Ex{c in Components:c in {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
Con Cns_Ex{c in Components inter {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
If you know that "R2" and "R5" are both in Components, you can make it even simpler:
Con Cns_Ex{c in {"R2", "R5"}}:Sum{p in Products} X
*Qty[p,c]<=8;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.