FCMP Procedure

Example 6: Using the SUBROUTINE Statement with a CALL Statement

Details

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.

Program

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

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

Output: Log

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