BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Parixit
Calcite | Level 5

Hi,

I am using PROC OPTMODEL to optimize interest rate 'i' . The objective function tries to maximize cash flows that are calculated using different in built SAS functions such as CUMPRINC which take 'i' as one of its input parameters. The result on running the PROC is that it is not able to calculate the initial value of the objective function. After playing around a bit we realized that the reason for it might be that CUMPRINC cannot be called from within OPTMODEL. Is there a specific syntax to call functions like CUMPRINC from within OPTMODEL?

Thanks,

Parikshit

1 ACCEPTED SOLUTION

Accepted Solutions
gergely_batho
SAS Employee

An example that runs in SAS/OR 13.1 (only syntactically correct):

proc optmodel;

var rate init 0.09/12;

max xx=cumprinc(rate, 360, 125000, 12, 24, 0) - cumprinc(rate, 300, 125000, 12, 24, 0);

solve;

put rate;

quit;

What did you try? What is the version of SAS/OR you are using?

View solution in original post

4 REPLIES 4
gergely_batho
SAS Employee

An example that runs in SAS/OR 13.1 (only syntactically correct):

proc optmodel;

var rate init 0.09/12;

max xx=cumprinc(rate, 360, 125000, 12, 24, 0) - cumprinc(rate, 300, 125000, 12, 24, 0);

solve;

put rate;

quit;

What did you try? What is the version of SAS/OR you are using?

RobPratt
SAS Super FREQ

As Gergely points out, the financial functions are supported in PROC OPTMODEL.  And the documentation contains such an example:

SAS/OR(R) 13.2 User's Guide: Mathematical Programming Examples

I recommend one of the following remedies:

1. trying different initial values for the variables used in the function

2. using the MULTISTART option in the SOLVE WITH NLP statement: SAS/OR(R) 13.2 User's Guide: Mathematical Programming

3. using the NOINITVAR option in the PROC OPTMODEL statement: SAS/OR(R) 13.2 User's Guide: Mathematical Programming

Parixit
Calcite | Level 5

Thanks Rob. I was submitting infeasible paramters to CUMPRINC via a loop.

Parixit
Calcite | Level 5

Thank you Gergely. Turns out something was wrong with the parameters being submitted for CUMPRINC. Thanks for the help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 1090 views
  • 3 likes
  • 3 in conversation