Create a function for Garman-Kohlhagen pricing for FX options. A function called GARKHPRC is declared, which calculates Garman-Kohlhagen pricing for FX options. The function uses the SAS functions GARKHCLPRC and GARKHPTPRC.


   function garkhprc (type$, buysell$, amount,
                      E, t, S, rd, rf, sig);
      if buysell = "Buy" then sign = 1.;
      else do;
         if buysell = "Sell" then sign = -1.;
         else sign = .;
      end;

      if type = "Call" then
         garkhprc = sign * amount 
                         * garkhptprc (E, t, S, rd, rf, sig);
      else do;
         if type = "Put" then
            garkhprc = sign * amount 
                            * garkhptprc (E, t, S, rd, rf, sig);
         else garkhprc = .;
      end;