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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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