BookmarkSubscribeRSS Feed
lalaala
Calcite | Level 5

Hello, I have an assignment where I have to optimize a sum of 44 functions, here is my code:

proc optmodel;
var x{1..2};
con .49*x[2] -x[1]*x[2] -0.9 >= 0;
con .4 <=x[1];
con .4 <= x[2];
min f = put(sum {i in 1..44} ((2+i) - x[1]- (.49 -x[1])*exp(-x[2]*(8/i-8)))**2);
solve;
print x[1] x[2];
run;

I keep getting this error:

image.png

2 REPLIES 2
lalaala
Calcite | Level 5

I've solved it, put wasn't necessary.

ballardw
Super User

For future posts it helps to post the code and error messages copied from the log. The entire data step or proc step and all of the messages. Copy from the LOG and paste into a code box as you did for the code.

 

Often there are diagnostic characters in the log to indicate where the error was triggered.

 

In this case I would suspect an underscore character appeared under the PUT of the offending line.

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

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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