I am creating a new function (trims). Before running that code however I would like to check if I've already created the function, and if so delete it. The part that is not working for me is the first line, checking for the existence of a function. I have tried variation, to the memtype (i.e. change "catalog" to "all", or deleted it, and let it default.) I have also tried the cexist function. No luck. Help!
I'm trying to elimanate the WARNINGs the code produces if I don't first delete the function...
%if %sysfunc(exist(userfuncs.package1,catalog)) %then %do;
/* delete previous function definition during debugging */
options cmplib=work.userfuncs;
proc fcmp outlib=work.userfuncs.package1;
deletefunc trims;
run;
%end;
/* new function defintion */
proc fcmp outlib=work.userfuncs.package1;
function trims(f $, str $, clist $, mod $) $32767;
from = 1;
last = length(str);
if upcase(f) in ('L', 'B') then from = findc(str, clist, 'K'||mod);
if from=0 then return('');
if upcase(f) in ('T', 'B') then last = findc(str, clist, 'K'||mod, -last);
if last=0 then return('');
return(substr(str, from, last-from+1));
endfunc;
run;
I'm running this from SAS-EG 7.13, connecting to a Unix server
Thanks Rodney