求助各位高手:
有一个循环,变量ww1--ww10 共10个,每个变量从0-5循环,得到x=5的组合。
data aa ;
do ww1 =0 to 5;
do ww2 =0 to 5;
do ww3 =0 to 5;
do ww4 =0 to 5;
do ww5 =0 to 5;
do ww6 =0 to 5;
do ww7 =0 to 5;
do ww8 =0 to 5;
do ww9 =0 to 5;
do ww10 =0 to 5;
x=ww1+ww2+ww3+ww4+ww5+ww6+ww7+ww8+ww9+ww10;
i+1;
if x=5 then
do;
i1+1;
output;
end; end; end; end; end; end;
end; end; end; end; end;
run;
程序循环了50388481次,得到X=5的全部组合有2002个。怎样让这个循环次数缩水,最好只循环2002次?
如果有20个变量ww1--ww20,每个变量从0-5循环,得到x=5的全部组合,就需要循环9.536E13次,有没有解决办法?
<script type="text/javascript"></script><script src="https://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script></script>