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

proc optmodel;
var XA1,XA2,XA3,XB1,XB2,XB3,XC1,XC2,XC3,XD1,XD2,XD3;
max Z = 500XA1 + 650XA2 + 400XA3 + 750XB1 + 800XB2 + 700XB3 + 300XC1 + 400XC2 + 500XC3 + 450XD1 + 600XD2 + 550XD3;
con
XA1+XB1+XC1+XD1=12,
XA2+XB2+XC2+XD2=17,
XA3+XB3+XC3+XD3=11,
XA1+XA2+XA3=10,
XB1+XB2+XB3=10,
XC1+XC2+XC3=10,
XA1>=0,XA2>=0,XA3>=0,XB1>=0,XB2>=0,XB3>=0,XC1>=0,XC2>=0,XC3>=0,XD1>=0,XD2>=0,XD3>=0;
solve;
print XA1 XA2 XA3 XB1 XB2 XB3 XC1 XC2 XC3 XD1 XD2 XD3;run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Best practice is to copy from the log the entire procedure or data step that throws an error along with all the errors, notes and warnings. Then paste the copied text into a text box opened on the forum with the </> icon. That preserves text formatting and shows the diagnostic characters properly in relation to the code.

ERROR 22-322 typically shows an ____ at the offending position. There error may be caused by a prior line improperly terminated (missing semicolon or semicolon in unexpected location).

 

Note that the message windows on this forum will reformat text and may have removed a character causing issues if it was a white space character.

 

Suspect this line is a likely cause:

max Z = 500XA1 + 650XA2 + 400XA3 + 750XB1 + 800XB2 + 700XB3 + 300XC1 + 400XC2 + 500XC3 + 450XD1 + 600XD2 + 550XD3;

500xa1 doesn't look like a valid variable and there is no operation.

 

if you intend to multiply Xa1 by 500 you need to explicitly put a multiply operator * between the variable and the value.

500*xa1 + 650*xa2 ...

View solution in original post

2 REPLIES 2
ballardw
Super User

Best practice is to copy from the log the entire procedure or data step that throws an error along with all the errors, notes and warnings. Then paste the copied text into a text box opened on the forum with the </> icon. That preserves text formatting and shows the diagnostic characters properly in relation to the code.

ERROR 22-322 typically shows an ____ at the offending position. There error may be caused by a prior line improperly terminated (missing semicolon or semicolon in unexpected location).

 

Note that the message windows on this forum will reformat text and may have removed a character causing issues if it was a white space character.

 

Suspect this line is a likely cause:

max Z = 500XA1 + 650XA2 + 400XA3 + 750XB1 + 800XB2 + 700XB3 + 300XC1 + 400XC2 + 500XC3 + 450XD1 + 600XD2 + 550XD3;

500xa1 doesn't look like a valid variable and there is no operation.

 

if you intend to multiply Xa1 by 500 you need to explicitly put a multiply operator * between the variable and the value.

500*xa1 + 650*xa2 ...

jinssbox
Calcite | Level 5

Thank you.

explicitly keeping  multiply operator * between the variable and the value worked.

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

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1325 views
  • 1 like
  • 2 in conversation