BookmarkSubscribeRSS Feed
PiergiorgioC
Calcite | Level 5

Hi all, 

 

When submitting the following code to create a subroutine to be used in a pricing function within Risk Dimension, I receive the error stated in the subject. 

 

proc compile outlib = Rd_env.SampleRDEnv  
env = Rd_env.SampleRDEnv 
   package = FUNCPACK;
 
  /*
  Function PV_DUR_CSHFLW is used to calculates the Present Value and the Macauley Duration
  */
 
  subroutine PV_DUR_CSHFLW (N ,VDate, Date[*], Amount[*], ZCCurve[*],ZCCMAT[*], Present_Value, MacDuration)
label = "Present Value function" 
    kind  = "Pricing Functions";
outargs Present_Value, MacDuration;
Present_Value = 0;
MacDuration   = 0;  
do i = 1 to N;
p = Date[i] - VDate;
p_year = p/365.25; 
if p gt 0 then do;
r             = RATE_RF2(p_year, ZCCURVE, ZCCMAT);
d             = exp( -p_year*log(1 + r/100));
MacDuration   = MacDuration + (p_year * d *(Amount[i]));
Present_Value = Present_Value + d*(Amount[i]);             
end; 
end;
if Present_Value gt 0 then do;
MacDuration = MacDuration/Present_Value;
end;
else do; MacDuration = 0; end;
 
  endsub;
run;
 
Does anyone know how to solve that?
 
Thanks in advance for your help!
7 REPLIES 7
Tom
Super User Tom
Super User

What is PROC COMPILE? Never heard of that.

PiergiorgioC
Calcite | Level 5
It's a procedure specific for Risk Dimension used to create and register functions, subroutines and pricing methods in a risk environment
Kurt_Bremser
Super User

Did you get that ERROR in the log? If yes, post the complete log of that procedure step into a window opened with the </> button. We might be able to provide some pointers from that.

Since you are a user of RD, you should get access to the documentation mentioned above; since we don't have that access, we can't apply our doc-fu to help.

 

@ChrisHemedinger @ShelleySessoms could you check for us why there is a password wall for that particular documentation?

ShelleySessoms
Community Manager

There are a few pieces of documentation that are password protected, to be accessed by only licensed customers due to proprietary information: "The documentation for SAS Risk Dimensions is provided on a secure site that requires an access key. Licensed customers can request the access key from SAS Technical Support. In order to expedite your request, please include SAS Risk Dimensions in the subject field of the form."

 

@SASKiwi is correct in that contacting Tech Support is the best option here. They can not only help answer the question, but they can provide the access key to the documentation.

 

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
SASKiwi
PROC Star

@PiergiorgioC - The documentation for this product is password-secured so only RD customers will be able to help. I suggest you track this SAS Tech Support.

ArnoldP
Obsidian | Level 7

Working without any problem (RD 6.12).

Just the call of the RATE_RF2 I need to skip as this is not know in my project.

 

%let ENV_NM= myEnv;
%let OUTLIB_NM = work;
proc risk noseqcheck ;

environment new = work.&ENV_NM ;

run;

proc compile outlib = &OUTLIB_NM.
env = &ENV_NM.
package = FUNCPACK;

/*
Function PV_DUR_CSHFLW is used to calculates the Present Value and the Macauley Duration
*/

subroutine PV_DUR_CSHFLW (N ,VDate, Date[*], Amount[*], ZCCurve[*],ZCCMAT[*], Present_Value, MacDuration)
label = "Present Value function"
kind = "Pricing Functions";
outargs Present_Value, MacDuration;
Present_Value = 0;
MacDuration = 0;
do i = 1 to N;
p = Date[i] - VDate;
p_year = p/365.25;
if p gt 0 then do;
/*r = RATE_RF2(p_year, ZCCURVE, ZCCMAT); not know in my Project XXX */
r = 1;
d = exp( -p_year*log(1 + r/100));
MacDuration = MacDuration + (p_year * d *(Amount[i]));
Present_Value = Present_Value + d*(Amount[i]);
end;
end;
if Present_Value gt 0 then do;
MacDuration = MacDuration/Present_Value;
end;
else do;
MacDuration = 0;
end;
endsub;
run;

 

Log:

26         %let ENV_NM= myEnv;
27         %let OUTLIB_NM = work;
28         proc risk noseqcheck ;
29         
30               environment new = work.&ENV_NM ;
31         
32         run;

NOTE: Statement parsing used 0 seconds of CPU time.
NOTE: The SAS Risk Dimensions engine is running at version 6.12.
NOTE: The current environment is "myEnv" in the directory 
      "/saswork/SAS_work067500016C18_sasgxxx/SAS_work214D00016C18_xxx.eb.lan.at/".
NOTE: PROCEDURE RISK used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

33         
34         proc compile outlib = &OUTLIB_NM.
35         			 env = &ENV_NM.
36            			 package = FUNCPACK;
NOTE: The SAS Risk Dimensions engine is running at version 6.12.
37         
38           /*
39           Function PV_DUR_CSHFLW is used to calculates the Present Value and the Macauley Duration
40           */
41         
42           subroutine PV_DUR_CSHFLW (N ,VDate, Date[*], Amount[*], ZCCurve[*],ZCCMAT[*], Present_Value, MacDuration)
43         label = "Present Value function"
44             kind  = "Pricing Functions";
45         outargs Present_Value, MacDuration;
46         Present_Value = 0;
47         MacDuration   = 0;
48         do i = 1 to N;
49         p = Date[i] - VDate;
50         p_year = p/365.25;
51         if p gt 0 then do;
52         /*r             = RATE_RF2(p_year, ZCCURVE, ZCCMAT);*/
53         r = 1;
54         d             = exp( -p_year*log(1 + r/100));
55         MacDuration   = MacDuration + (p_year * d *(Amount[i]));
56         Present_Value = Present_Value + d*(Amount[i]);
57         end;
58         end;
59         if Present_Value gt 0 then do;
60         MacDuration = MacDuration/Present_Value;
61         end;
62         else do; MacDuration = 0; end;
63         
64           endsub;
65         run;

NOTE: Function PV_DUR_CSHFLW saved to WORK.work.FUNCPACK.
NOTE: PROCEDURE COMPILE used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
Discussion stats
  • 7 replies
  • 1188 views
  • 0 likes
  • 6 in conversation