turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Macro variable - Urgent Help

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-21-2009 09:48 PM

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..

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to 1234567

07-21-2009 09:54 PM

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 ;

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

c2val

sensval

end;

create data mrocBP from

quit ;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to 1234567

07-21-2009 09:56 PM

Can't put all the sas code!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to 1234567

07-21-2009 10:04 PM

Chris@NewZealand

and

Daniel Santos

Please your help

and

Daniel Santos

Please your help

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to 1234567

07-22-2009 03:35 AM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to 1234567

07-22-2009 10:18 AM

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.

Scott Barry

SBBWorks, Inc.