Previous Page | Next Page

The FCMP Procedure

Example 1: Creating a Function and Calling the Function from a DATA Step


Procedure features:

PROC FCMP statement option

OUTLIB=

DATA step


This example shows how to compute a study day during a drug trial by creating a function in FCMP and using that function in a DATA step.


Program

 Note about code
proc fcmp outlib=sasuser.funcs.trial;
 Note about code
   function study_day(intervention_date, event_date);
 Note about code
      n = event_date - intervention_date;
         if n >= 0 then
            n = n + 1;
         return (n);
   endsub;
 Note about code
options cmplib=sasuser.funcs;
 Note about code
data _null_;
   start = '15Feb2008'd;
   today = '27Mar2008'd;
   sd = study_day(start, today);
 Note about code
   put sd=;
 
 Note about code
run;

Output

sd=42

Previous Page | Next Page | Top of Page