Here's another way of coding it and avoiding both types of irritating Proc FCMP warning messages (i.e. "No CMP or C functions found in library work.funcs" and "Function fTerm is already defined...") when running it multiple times in the same session: %macro compfunc(num_months=); %let funcexists=n; data _null_; %if %sysfunc(exist(work.funcs)) %then %do; set work.funcs(where=(type eq 'Prototype' and lowcase(name) eq "mi5152")); call symput('funcexists',"y"); stop; %end; run; %if &funcexists eq n %then %do; proc fcmp outlib=work.funcs.mi5152; function fTerm(interm); if interm < &num_months. then return (&num_months. - 1); else return (interm); endsub; run; options cmplib=work.funcs; %end; %mend compfunc; %compfunc(num_months=??);
... View more