Run PROC OPTMODEL on each row/obs

Reply
N/A
Posts: 1

Run PROC OPTMODEL on each row/obs

The data set is as below:

ObsAretBretAstdevBstdevCorr
10.120.030.210.020.31
20.090.060.180.070.54
......
1000.110.040.170.020.44

Basically I have expected returns, stdev and correlation of two stocks A & B for 100 years. From these two stocks, I have to construct a portfolio with min variance for each year=> 100 optimal portfolios. =>Then I have to print out the optimization results for all 100 optimizations in one table.

Could you please give my some suggestions/ comments?

Here is my attempt:

%macro MVP_OPT(100);

   %do i=1 %to &100 by 1;

      R%i=(1 Corr%i, Corr%i 1);

      C%i=(Astdev%i, Bstdev%i);

      D%i=diag(C%i);

S%i = D%i*R%i*D%i; /** covariance matrix **/

W%i=( Bweight%i, 1-Aweight%i);

Transw%i=t(W%i);

proc optmodel;

var Aweight%i>=0, 1-Aweight%i>=0;

min f= Transw%i*S%i*W%i /**find min of portfolio variance**/

solve with qp;

run;

   %end;

%mend MVP_OPT;

%print Aweight;

Thanks a bunch!!!!

J.Z.

SAS Employee
Posts: 424

Re: Run PROC OPTMODEL on each row/obs

Questions about PROC OPTMODEL in SAS/OR are better suited for the Mathematical Optimization and Operations Research Community.  If you still need help, please post there.

Ask a Question
Discussion stats
  • 1 reply
  • 130 views
  • 0 likes
  • 2 in conversation