FCMP Procedure

Example 4: Using Character Data in the FUNCTION Statement

Details

The following example uses character data as input to the FUNCTION statement of PROC FCMP. The output from FUNCTION test is assigned a length of 12 bytes.

Program

options cmplib = work.funcs;

proc fcmp outlib=work.funcs.math;
   function test(x $) $ 12;
   if x = 'yes' then
      return('si si si');
      else
      return('no');
   endsub;
run;

data _null_;
   spanish=test('yes');
   put spanish=;
run;

Output: Log

Output from Using Character Data in the Function Statement
spanish=si si si