Parameters 如何定义具有不同数量参数的函数?
我不熟悉Parameters 如何定义具有不同数量参数的函数?,parameters,sas,varying,fcmp,Parameters,Sas,Varying,Fcmp,我不熟悉proc fcmp,我想知道如何在SAS中编写具有不同数量参数的用户定义函数,如whichc()或coalesce() 如果有人能给我一些提示,我将不胜感激。这是不可能的,尽管您可以按如下所述传递数组(复制如下): function sas_summation (b[*]) varargs; total = 0; do i = 1 to dim(b); total = total + b[i]; end; return(total); endsub; ru
proc fcmp
,我想知道如何在SAS中编写具有不同数量参数的用户定义函数,如whichc()
或coalesce()
如果有人能给我一些提示,我将不胜感激。这是不可能的,尽管您可以按如下所述传递数组(复制如下):
function sas_summation (b[*]) varargs;
total = 0;
do i = 1 to dim(b);
total = total + b[i];
end;
return(total);
endsub;
run;
quit;
options cmplib=work.functions;
data one;
input x1-x5;
datalines;
1 2 3 4 5
2 3 4 5 6
4 5 6 7 8
;
run;
data two;
set one;
array temp (5) _temporary_;
array perm2 (*) x1-x5;
do i=1 to dim(temp);
temp(i)=perm2(i);
end;
drop i;
x=sas_summation(temp);
run;