The OLS problem can also be viewed as minization problem. Here is an example to solve it with proc optmodel.
%let n=10000;
data t1;
do i=1 to &n;
x=rannor(123);
y=1+1*x+rannor(123);
x0=1;
output;
end;
keep y x x0;
run;
proc reg data=t1;
model y=x;
run;
quit;
proc optmodel;
set I = 1 .. &n;
number y{I};
number x{I};
number x0{I};
read data t1 into [_n_] y x x0;
var b0, b1;
min f =
sum{k in I}
( y[k] - (b0*x0[k] + b1*x[k]))**2;
reset printlevel=2;
solve with nlp;
solve with qp;
print f b0 b1;
quit;