楼主: 小甲克虫
889 2

[问答] 程序代码求助? [推广有奖]

  • 9关注
  • 12粉丝

教授

12%

还不是VIP/贵宾

-

威望
0
论坛币
8160 个
通用积分
116.0411
学术水平
10 点
热心指数
20 点
信用等级
8 点
经验
37018 点
帖子
703
精华
0
在线时间
1457 小时
注册时间
2005-9-20
最后登录
2023-6-16
毕业学校
中南财经政法大学

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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个,单独放置出来?还是变量不动,只是指针变动?
二维码

扫码加我 拉你入群

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

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

关键词:程序代码 array Data 我的问题 null 程序

沙发
davil2000 发表于 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.



已有 1 人评分学术水平 热心指数 信用等级 收起 理由
数据分析师3K + 1 + 5 + 3 观点有启发

总评分: 学术水平 + 1  热心指数 + 5  信用等级 + 3   查看全部评分

R是万能的,SAS是不可战胜的!

使用道具

藤椅
小甲克虫 在职认证  发表于 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, ...
达人可否就上边那个例子来分析下??

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 12:22