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