BookmarkSubscribeRSS Feed
1234567
Calcite | Level 5
Proc optmodel run 20 different optimizations and results were saved in sas dataset. I want to save c1 and c2 from the previous results as a macro variable and then pass them back to PROC OPTMODEL for the next optimization. So by doing this the previous results of c1 and c2 will be used as starting values for the next run. Thanks..
5 REPLIES 5
1234567
Calcite | Level 5
proc optmodel ;
var c1 init - 3 >= - 3 <= 2.93;
var c2 init - 3 >= - 3 <= 8.86;
number a; set R= 1..20; number aval{i in R} = i/20; number c1val{i in R}, c2val{i in R}, c3val{i in R}; number sensval{i in R};
max Sensitivity = 1-probbnrm((c1-1.43)/.5,(c2-2.86)/2, 0);
con FPF: 1-probbnrm((c1-0)/1,(c2-0)/1, 0) <= a;
for {i in R} do;
a = aval;
solve with IPNLP / MAXTIME=14400 MAXITER=100000 printfreq = 0 ;
c1val = c1;
c2val = c2;
sensval = Sensitivity;
end;
create data mrocBP from FPR=aval c1=c1val c2=c2val MTPR=sensval ;
quit ;
1234567
Calcite | Level 5
Can't put all the sas code!
1234567
Calcite | Level 5
Chris@NewZealand
and
Daniel Santos

Please your help
DanielSantos
Barite | Level 11
Hello.

I'm not sure I got this right...

You just need to call proc optmodel several times (at leas 2 times) feeding the output of the previous iterations (CREATE DATA OUT) to the input of the next (READ DATA IN). Is this right?

How is your code structured? Are we talking about a single script?
And is it a single call to the optmodel procedure per script, or is it possible to have more than one call in same script?

Finally, how many iterations do need?

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
An intermediate DATA step using CALL SYMPUT will allow you to capture a SAS variable value and place it in a SAS global/local macro variable, for later use. If you are working with a macro and a %DO / %END loop, you can declare the macro variable up-front using %LOCAL or %GLOBAL, and then use an %IF %THEN testing the %LENGTH() to determine the first execution and then don't do something on the first DO loop execution (there are also other techniques as well).

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 847 views
  • 0 likes
  • 3 in conversation