Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 04-24-2017 10:09 AM
(897 views)

Hello everyone,

I am a beginner and I am trying to play around with OPTMODEL, but I am getting a few errors I can't decipher. Is there a reference guide to go through the error codes they give us?

I enclose two error examples below.

Thank you.

102 con MaxNumberFactory: sum{i in Factory}Y[i]=>2;

_

22

200

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,

a missing value, (, +, -, /, IF, INPUT, INTER, MAX, MIN, PROD, PUT, SETOF, SLICE, SUM, UNION, {.

ERROR 200-322: The symbol is not recognized and will be ignored.

107 print X{Factory,Store};

_

22

ERROR 22-322: Expecting a name.

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

First of all, use the {i} icon to post log snippets. Otherwise the white space in the logs is lost and with it the positioning of the ERROR messages (which point to the exact location in the code).

Second, don't post single log lines. ERRORs must be seen in context, so post the log of the complete step.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

OK, so I've progressed but now it's giving me a submission error.

The full details are:

{} [TRACEBACK] at Object.<anonymous> (https://odamid.oda.sas.com/SASStudio/resources/js/webdms/DMSEditor.js:221:166) at Object.error (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:146:271) at https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:159:394 at c (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:66:221) at d (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:66:10) at b.Deferred.reject.errback (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:68:1) at c (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:66:493) at d (https://odamid.oda.sas.com/SASStudio/resources/js/dojo/dojo/dojo.js:66:10)

Now, the program that I wrote that gives me this error (and many others when I run it) is:

proc optmodel; /* specify parameters */ set Fact={"Fact1","Fact2","Fact3","Fact4","Fact5"}; set Store={"Stor1","Stor2","Stor3","Stor4","Stor5"}; number CostPerKmPerProduct{Fact,Store}=[ 1 2517 1761 4053 2065 2517 1 1708 1663 711 1761 1708 1 2443 1316 4053 1663 2443 1 2251 2065 711 1316 2251 1 ]; number Demand{Store}=[ 3241 1127 1817 11023 15860 ]; number FixedCost{Fact}=[ 100000 100000 100000 100000 100000 ]; number M = 100000; /* model description */ var X{Fact,Store} integer >= 0; var Y{Fact} binary; min z = sum{i in Fact}sum{j in Store}X[i,j]*CostPerKmPerProduct[i,j] + sum{i in Fact}FixedCost[i]*Y[i]; con MinDemand{j in Store}: sum{i in DC}X[i,j] = Demand[j]; con Linking{i in Fact, j in Store}: X[i,j]-M*Y[i]<=0; con MinFact: sum{i in Fact}Y[i]=>4; con MaxFact: sum{i in Fact}Y[i]<=5; /* output and solve */ solve; print z X{Fact,Store} Y{Fact}; quit;

Thanks for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If "the program that I wrote that gives me this error (and many others when I run it) is:"

then show the entire log for that step. The error messages will likely have many clues. Again post the log to include the code and any errors, warning or notes in a code box.

I note that the line with the error message in the original post does not occur in the example Proc Optmodel code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@ballardw:

I have put the whole error in the first code box, preceded by "the full details are".

This error doesn't allow me to run the procedure, so there is no log to share so far I'm afraid.

But I understand you manage to run the Proc Optmodel code? There must be an error with my SAS Studio software, then?

I have put the whole error in the first code box, preceded by "the full details are".

This error doesn't allow me to run the procedure, so there is no log to share so far I'm afraid.

But I understand you manage to run the Proc Optmodel code? There must be an error with my SAS Studio software, then?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

your optmodel code does not run.

1. In your mindemand constraint you are summing over i in DC, where DC is not a defined set.

2. The greater or equal to sign in the MinFact constraint should be >=

3. In your print statement you should not have the index specification on your variables. Just write print z X Y

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I am still getting the error preventing me from running the procedure (first error in my second post, with the screenshot). I attach below the corrected code I am using:

proc optmodel; /* specify parameters */ set Fact={"Fact1","Fact2","Fact3","Fact4","Fact5"}; set Store={"Stor1","Stor2","Stor3","Stor4","Stor5"}; number CostPerKmPerProduct{Fact,Store}=[ 1 2517 1761 4053 2065 2517 1 1708 1663 711 1761 1708 1 2443 1316 4053 1663 2443 1 2251 2065 711 1316 2251 1 ]; number Demand{Store}=[ 3241 1127 1817 11023 15860 ]; number FixedCost{Fact}=[ 100000 100000 100000 100000 100000 ]; number M = 100000; /* model description */ var X{Fact,Store} integer >= 0; var Y{Fact} binary; min z = sum{i in Fact}sum{j in Store}X[i,j]*CostPerKmPerProduct[i,j] + sum{i in Fact}FixedCost[i]*Y[i]; con MinDemand{j in Store}: sum{i in Fact}X[i,j] = Demand[j]; con Linking{i in Fact, j in Store}: X[i,j]-M*Y[i]<=0; con MinFact: sum{i in Fact}Y[i]>=4; con MaxFact: sum{i in Fact}Y[i]<=5; /* output and solve */ solve; print z X Y; quit;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Can anybody advise as to where I could contact SAS to get help on this configuration issue?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You might try the SAS Studio community: https://communities.sas.com/t5/SAS-Studio/bd-p/sas_studio

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.