高明的没有,我弄出来个取巧的法,也不知道我有没有理解错误。
首先你要对group排序,
%macro create(dbn,dbo);
data &dbn;
set &dbo end=final;
groupl=lag(group);
if group^=groupl then n+1;
if final then call symput('number',n);
run;
%mend create;
%macro choice(q,p);
%create(new,old);
%if %eval(&number)=%eval(&q) %then %pro1(a);
%else %if %eval(&number)=%eval(&p) %then %pro2(b);
%mend choice;
%choice(2,3);
这样应该就能按你说的 根据group 里面不同数, 选择不同程序。

[em01]