BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wutao9999
Obsidian | Level 7

In SAS OPTMODEL procedure, let's assume we have four string sets: products {pro1, pro2, pro3}, items {pro1, pro2, pro3}, fakeitem {pro1, pro3}, gooditem {pro1, gooda, goodb};

and one number, cost(products) = {3, 5, 2}.

Then apparently, we have sum{p in products} cost(p) = 10.

My question to you is that: Are the below three equations true as well?

sum{p in items} cost(p) = 10;

sum(p in fakeitem} cost(p) = 5;

sum(p in gooditem} cost(p) = 3.

Appreciate your answers, thank you very much.

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

The first two equations are true.  The third equation requires cost['gooda'] and cost['goodb'] to be defined.  You could assign those costs to be 0, and then the third equation would be true.  Alternatively, you could modify the sum in the third equation in any of the following three ways:


sum{p in gooditem inter products} cost

sum{p in gooditem: p in products} cost

sum{p in gooditem} (if p in products then cost

)


Each of these approaches would yield 3.

View solution in original post

1 REPLY 1
RobPratt
SAS Super FREQ

The first two equations are true.  The third equation requires cost['gooda'] and cost['goodb'] to be defined.  You could assign those costs to be 0, and then the third equation would be true.  Alternatively, you could modify the sum in the third equation in any of the following three ways:


sum{p in gooditem inter products} cost

sum{p in gooditem: p in products} cost

sum{p in gooditem} (if p in products then cost

)


Each of these approaches would yield 3.

sas-innovate-2024.png

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.

 

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
  • 760 views
  • 0 likes
  • 2 in conversation