全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1091 2
2012-11-21
data _null_;
array x[5] $3 ('ant' 'bee' 'cat' 'dog' 'ewe');
n=dim(x); k=3;
ncomb=comb(n,k);
do j=1 to ncomb+1;
rc=allcomb(j, k, of x[*]);
put j 5. +3 x1-x3 +3 rc=;
我的问题是,ALLCOMB函数运行原理是什么?即:从5个变量抽出3个,单独放置出来?还是变量不动,只是指针变动?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-11-22 08:27:48
COMB(n,k) function computes the number of combinations of n elements taken k at a time.
ALLCOMB(j, k, of x
[*]) function generates all combinations of the values of j variables taken k at a time in a minimal change order.

For the ALLCOMB function, the following actions occur:
1.On the first execution, ALLCOMB returns 0.
2.If the values of variable-i and variable-j were interchanged, where i<j, then ALLCOMB returns i.
3.If no values were interchanged because all combinations were already generated, then ALLCOMB returns –1.



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-11-22 10:38:24
davil2000 发表于 2012-11-22 08:27
COMB(n,k) function computes the number of combinations of n elements taken k at a time.
ALLCOMB(j, ...
达人可否就上边那个例子来分析下??
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群