Robert Penridge
Robert Penridge

Reputation: 8513

Proc FCMP - default parameter values

Is it possible to specify a default value for proc fcmp function parameters? Something like this:

proc fcmp outlib=work.funcs.funcs;

  function my_func(param1, param2='default_value_here' $);
    * DO STUFF;
  endsub;

run;

From the documentation and the error messages I'm receiving, I'm not seeing anything that would indicate that it is supported but it seems like it would be a big oversight if that is the case.

SAS 9.4TSM4

Upvotes: 2

Views: 566

Answers (1)

Allan Bowe
Allan Bowe

Reputation: 12691

It's not possible in the way you describe (as in, obviously, you could emulate a default by applying equivalent logic in the function itself). The thing is, if there was a default, it could not be invoked..

You see, proc fcmp does not support 'optional' arguments (except the VARARGS array). So you would always have to supply a value (which could include missing or a null reference), hence the default would never be applied.

If this ever comes up in a SASware ballot, it gets my vote - optional arguments should definitely be an option in fcmp!

Upvotes: 2

Related Questions