- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rob
This is from https://communities.sas.com/t5/Mathematical-Optimization/Open-a-Facility-with-constraint/m-p/565617/...
I am trying to see the results my various cost buckets. For example, if i want to see my Inbound_Linehaul_Costs (that is an implicit variable in the model) by different lanes (lanes are Ports-IC combinations), how do i do that? Can you help me with that. My model succesfully solved. I just dont know how to extract the relevant outputs.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, try this instead:
print {p in Ports, c in IC} (InboundLinehaul [p,c] * sum {d in DC} ContainersfromPortstoICtoDC [p,c,d]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Does this do what you want?
print {p in Ports, c in IC} (sum {d in DC} Inbound_Linehaul_Costs[p,c,d]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
HI rob
I tried that. I got an error that said:
ERROR 616-782: The name 'Inbound_Linehaul_Costs' must be an array.
Inbound_Linehaul_Costs is an impvar in my model
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, try this instead:
print {p in Ports, c in IC} (InboundLinehaul [p,c] * sum {d in DC} ContainersfromPortstoICtoDC [p,c,d]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
HI Rob.
Thank you ,. That worked like a charm. But a question I have, so we have to do the formula of Number of containers * Costs again . Right?
Also, how do I create a dataset of this printstatement you mentioned. Because if we can do that, I can probably download that into xls or whatever format is convenient for the end user. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's one way:
create data outdata from [p c]={p in Ports, c in IC}
Inbound_Linehaul_Costs_p_c=(InboundLinehaul[p,c] * sum {d in DC} ContainersfromPortstoICtoDC[p,c,d]);
Alternatively, you can declare another IMPVAR so that the formula appears in only one place:
impvar Inbound_Linehaul_Costs_p_c {p in Ports, c in IC}
= InboundLinehaul[p,c] * sum {d in DC} ContainersfromPortstoICtoDC[p,c,d];
impvar Inbound_Linehaul_Costs
= sum {p in Ports, c in IC} Inbound_Linehaul_Costs_p_c[p,c];
create data outdata from [p c] Inbound_Linehaul_Costs_p_c;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Ok. Let me try these and let you know. Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Awesome. That worked. Your guidance had greatly helped me from start to finish for my first sas model. Eager to learn more in future.
Thanks for your time and effort
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Glad to help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If i want to restrict to only those where the costs >0 ,how do i specify that?
create data outdata from [p c]={p in Ports, c in IC} Inbound_Linehaul_Costs_p_c=(InboundLinehaul[p,c] * sum {d in DC} ContainersfromPortstoICtoDC[p,c,d]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One way is to use a WHERE= data set option in the CREATE DATA statement:
create data outdata(where=(Inbound_Linehaul_Costs_p_c > 0)) from [p c]={p in Ports, c in IC}
Inbound_Linehaul_Costs_p_c=(InboundLinehaul[p,c] * sum {d in DC} ContainersfromPortstoICtoDC[p,c,d]);
If you instead declared Inbound_LInehaul_Costs_p_c as an IMPVAR, you can also accomplish this by using a logical condition in the index set:
create data outdata from [p c]={p in Ports, c in IC: Inbound_Linehaul_Costs_p_c[p,c] > 0} Inbound_Linehaul_Costs_p_c;