Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Could anybody help for proc optmodel

Reply
New Contributor
Posts: 2

Could anybody help for proc optmodel

Hi All,

I am learning proc optmodel and writing the follow code. why the second one is ok but the first one is not. please advise. thank you.

proc optmodel;

var p1 >=0 <=1;
number n=4;
number k{1..n} =[0 1 2 3];
put k
  • =;



    min j=sum{i in 1..n} p1**k*(1-p1)**(800-k);

    con j>=1-0.95;
    solve;
    create data solution from p1=p1;
    run;
    quit;

    proc optmodel;

    var p1 >=0 <=1;


    min j=(1-p1)**800 + p1**1*(1-p1)**799+p1**2*(1-p1)**798+p1**3*(1-p1)**797;

    con j>=1-0.95;
    solve;
    create data solution from p1=p1;
    run;
    quit;
  • New Contributor
    Posts: 2

    Re: Could anybody help for proc optmodel

    why i can not post correct code? could anyone tell me?
    SAS Employee
    Posts: 32

    Re: Could anybody help for proc optmodel

    Hello,

    Unfortunately the forum does not like some character combinations that are needed for OPTMODEL code.

    The problem seems to be with "less than or equal", if you write it in symbols it disappears and also text following it. You might try posting your code again replacing "less than or equal" with something like LE or so. And check the preview if something else causes problem.

    Sorry for the inconvenience.
    Ask a Question
    Discussion stats
    • 2 replies
    • 258 views
    • 0 likes
    • 2 in conversation