BookmarkSubscribeRSS Feed
Calcite | Level 5

I am having trouble with coming up with the correct code to find VaR and
the optimal solution using proc optmodel. I have attached below the code I am using for a mean/variance approach to the optimal solution, but I'd like to use the mean/VaR approach as well. The code includes the expected returns and the
covariance matrix.

Could anyone help me in modifying my code to include finding VaR at the .05 level and to find the optimal allocation to each region?

proc optmodel;
/* x1, x2, x3 amount of available resources allocated to each of the three
region */
var x{1..3} >= 0;

num coeff{1..3, 1..3} = [0.0168011611 0.0164661727 0.0179412346
0.0164661727 0.0254631245 0.0178165208
0.0179412346 0.0178165208 0.0289536036];

num r{1..3}=[-0.0903476 -0.1342186 -0.1498193];

/* Minimize variance */
min f = sum{i in 1..3, j in 1..3} coeff[i,j]*x*x;

/* subject to the following constraints */
/* Total resources in 2006*/
con BUDGET: sum{i in 1..3}x = 56288890475;

solve with qp;

/* print the optimal solution */
print x 20.0;

Thank you so much for your help,

Steve Leon
Calcite | Level 5
Hi Steve,

I am not exactly sure what you are doing in the codes but I cannot find the expected return statement/constraint anywhere. Can you advise me on your product list as I think VAR should be computed external of this optimization run.




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2 in conversation