say I have a function f(x,y)=x+y, and the data set is given by
var
3
6
5
7
Now I want to minimize the the function (x+y-3)^2+(x+y-6)^2+(x+y-5)^2+(x+y-7)^2 with the constraints 0<x<5, 0<y<5.
I know the proc fcmp can be used to define a function like (x+y-3)^2, and optimize it under some constrains, but not sure how to use it on the whole column, any hints? Thanks.
The program is pretty much like this, and you may need to adjust the initial values (in parms statement) if the hessian matrix is singular.
proc nlin data=whatever method=marquardt;
parms x1=1 x2=0 to by 0.1;
bounds x1>=0;
model y=f(x1,x2);
output out=b predicted=yp;
run;
How does the value var relate to the function you want to minimize?
PROC NLIN would be my first choice
The program is pretty much like this, and you may need to adjust the initial values (in parms statement) if the hessian matrix is singular.
proc nlin data=whatever method=marquardt;
parms x1=1 x2=0 to by 0.1;
bounds x1>=0;
model y=f(x1,x2);
output out=b predicted=yp;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.