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

I am developing a model with proc optmodel and as I go through the process of testing and verifying solution values I am having to go through a very large number of variables, but the solution is sparse with most of them 0. Is there a way to print out the variable without all the 0 values?

 

For example "print DecisionVariable;" yields:

Set1Set2Set3DecisionVariable
1110
1211
1310
2110
2210
2310
3110
3210
3310

 

But I would like something that will just result in:

Set1Set2Set3DecisionVariable
1211

 

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

Here's one way, by using a selection expression in the PRINT statement:

 

print {i1 in Set1, i2 in Set2, i3 in Set3: DecisionVariable[i1,i2,i3].sol > 0.5} DecisionVariable; 

 

 

View solution in original post

2 REPLIES 2
RobPratt
SAS Super FREQ

Here's one way, by using a selection expression in the PRINT statement:

 

print {i1 in Set1, i2 in Set2, i3 in Set3: DecisionVariable[i1,i2,i3].sol > 0.5} DecisionVariable; 

 

 

nicwoyak
Obsidian | Level 7
Thank you so much. I just had to add some contingent clauses based on what my variable had that I hadn't mentioned above after the : (e.g. i1<>i2 etc.) and that worked perfectly.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Discussion stats
  • 2 replies
  • 737 views
  • 0 likes
  • 2 in conversation