| Procedure features: | 
| PROC FCMP statement option
 |  | 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.
|  | proc fcmp outlib=sasuser.funcs.trial; | 
|  |    function study_day(intervention_date, event_date); | 
|  |       n = event_date - intervention_date;
         if n >= 0 then
            n = n + 1;
         return (n);
   endsub; | 
|  | options cmplib=sasuser.funcs; | 
|  | data _null_;
   start = '15Feb2008'd;
   today = '27Mar2008'd;
   sd = study_day(start, today); | 
|  |    put sd=;
  | 
|  | run; | 
sd=42
 
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.