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

I have an issue with the finance('rate', , ,) function. 

 

27         data _null_;
28           rate=FINANCE('rate',9,-162.45,1461.48);
29           put rate=;
30         run;

NOTE: Invalid argument to function FINANCE('rate',9,-162.45,1461.48) at line 28 column 8.
rate=.
rate=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to 
      missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 28:8   
NOTE: DATA statement used (Total process time):
      real time           0.36 seconds
      cpu time            0.04 seconds

When I attempt the same calculation in excel (=RATE(9,162.45, -1461.48)*12) , I get a value, so the calculation is valid (also I am attempting this calculation on thousands of rows, this issue only impacts a handful).

 

I have searched SAS support and found the following 

http://support.sas.com/kb/55/525.html

 

suggesting this might be resolved by a hotfix Base SAS 9.3_M2 

 

However current version here is 9.04.01M4P110916. 

 

Any suggestions, or this better going via SAS administration on site here?

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Talk to your sas-admin, using 9.5m5, i get the expected result:

 

26         data _null_;
27         rate=FINANCE('rate',9,-162.45,1461.48);
28         put rate=;
29         run;

rate=0.000077995
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

30         
31         %put &=SYSVLONG4;
SYSVLONG4=9.04.01M5P09132017

View solution in original post

6 REPLIES 6
andreas_lds
Jade | Level 19

Talk to your sas-admin, using 9.5m5, i get the expected result:

 

26         data _null_;
27         rate=FINANCE('rate',9,-162.45,1461.48);
28         put rate=;
29         run;

rate=0.000077995
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

30         
31         %put &=SYSVLONG4;
SYSVLONG4=9.04.01M5P09132017
dmcwool
Fluorite | Level 6

Thanks - upgrade of the sas version is likely to be a long running battle, just on the off-chance, anyone got a code workaround for this?

andreas_lds
Jade | Level 19
The admins should - at least - check if a hotfix is available for the installed version.
dmcwool
Fluorite | Level 6

I can't find any details of a relevant hotfix that would resolve this, I'd rather go forearmed to sas admins, it's not usually an easy discussion (i.e. if I say, can you install hotfixes, then this doesn't solve the problem, I then have to go and ask them again so I'd rather just suggest something I'm confident will actually fix it).

 

Anyway, I found an alternative code solution in SAS - namely proc loan. Requires more coding as you can't pass a dataset to proc loan, so I need to pass each bit of data individually through some horrible macro code, then pick up the output each time and append it together. It's not a particularly good solution, but I can use it as an exception process....

 

 

  proc loan;
      fixed amount=1461.48 payment=162.45 life=9;
   run;

 

 

andreas_lds
Jade | Level 19

You don't need macro code, just call execute:

 

data have;
   input amountVar paymentVar lifeVar;
   datalines;
1461.48 162.45 9
3000 150 20
run;

data _null_;
   set have end=jobDone;

   if _n_ = 1 then do;
      call execute('proc loan noprint outsum=work.loans;');
   end;

   call execute(catx(' ', 'fixed amount=', amountVar, 'payment=', paymentVar, 'life=', lifeVar, ';'));

   if jobDone then do;
      call execute('run;');
   end;
run;
dmcwool
Fluorite | Level 6

Good point, thank you. Still not as neat as a single line sas function, however.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 888 views
  • 2 likes
  • 2 in conversation