FCMP Procedure

Example 6: Using the SUBROUTINE Statement with a CALL Statement


The following is an example of the SUBROUTINE statement. The SUBROUTINE statement creates an independent computational block of code that can be used with a CALL statement.


proc fcmp outlib=sasuser.funcs.temp;
subroutine inverse(in, inv) group="generic";
   outargs inv;
   if in=0 then inv=.;
   else inv=1/in;

options cmplib=sasuser.funcs;
data _null_;
   x = 5;
   call inverse(x, y);
   put x= y=;

Output: Log

Output from Using the SUBROUTINE Statement in PROC FCMP
x=5 y=0.2