Proc FCMP Creating a Call Routine and Function


/ Published in: SAS
Save to your folder(s)



Copy this code and paste it in your HTML
  1. proc fcmp outlib = sasuser.exsubs.pkt1;
  2.  
  3. Note about code
  4.  
  5. subroutine calc_years(maturity, current_date, years);
  6. outargs years;
  7. years = (maturity - current_date) / 365.25;
  8. endsub;
  9.  
  10. Note about code
  11.  
  12. function garkhprc (type$, buysell$, amount,
  13. E, t, S, rd, rf, sig);
  14. if buysell = "Buy" then sign = 1.;
  15. else do;
  16. if buysell = "Sell" then sign = -1.;
  17. else sign = .;
  18. end;
  19.  
  20. if type = "Call" then
  21. garkhprc = sign * amount
  22.   * garkhptprc (E, t, S, rd, rf, sig);
  23. else do;
  24. if type = "Put" then
  25. garkhprc = sign * amount
  26.   * garkhptprc (E, t, S, rd, rf, sig);
  27. else garkhprc = .;
  28. end;
  29.  
  30. Note about code
  31.  
  32. return (garkhprc);
  33. endsub;
  34.  
  35. Note about code
  36.  
  37. run;

URL: http://support.sas.com/documentation/cdl/en/proc/59565/HTML/default/a002890491.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.