Previous Page | Next Page

The PROTO Procedure

Example 1: Splitter Function Example


Procedure features:

INT statements

KIND= prototype argument

Other features:

PROC FCMP


This example shows how to use PROC PROTO to prototype two external C language functions called SPLIT and CASHFLOW. These functions are contained in the two shared libraries that are specified by the LINK statements.


Program

 Note about code
options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
proc proto package = sasusser.myfuncs.mathfun
           label = "package of math functions";
                                 
 Note about code
           link "link-library";
           link "link-library"; 
 Note about code
   int split(int x "number to split")
       label = "splitter function" kind=PRICING;
 Note about code
   int cashflow(double amt, double rate, int periods,
                double * flows / iotype=O)
       label = "cash flow function" kind=PRICING;
 Note about code
run;
 Note about code
proc fcmp libname=sasusser.myfuncs;
   array flows[20];
   a = split(32);
   put a;
   b = cashflow(1000, .07, 20, flows);
   put b;
   put flows;
run; 


Output: Listing

Output from the SPLIT and CASHFLOW Functions

                                           The SAS System                              1

                                         The FCMP Procedure

16                                                                                                  
12                                                                                                  
70 105 128.33333333 145.83333333 159.83333333 171.5 181.5 190.25 198.02777778 205.02777778          
211.39141414 217.22474747 222.60936286 227.60936286 232.27602953 236.65102953 240.76867658          
244.65756547 248.341776 251.841776      

Previous Page | Next Page | Top of Page