楼主: xuantai
2330 4

rantbl有没有比较好的向量缩写格式啊? [推广有奖]

  • 0关注
  • 0粉丝

小学生

42%

还不是VIP/贵宾

-

威望
0
论坛币
9 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
83 点
帖子
4
精华
0
在线时间
3 小时
注册时间
2009-2-17
最后登录
2010-8-15

楼主
xuantai 发表于 2010-8-14 13:13:19 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
rantbl的用法是rantbl(seed,p1,p2,.....,pn);seed是种子,p1到pn是n个概率。

我查的书里有这样的缩写格式:
array p{*} p1-pn;
rantbl(seed, of p{*} );
但是这就要求在data步里实现。

我写了一个程序在之前都是使用iml的,程序要求按照某个固定的概率向量取一些随机数。
比如我得到了一个向量pv,这里pv是一列数(当然都是概率啦)。请问有没有什么缩写方式可以在iml里能让rantbl直接使用这个pv呢?

我试的rantbl(seed,pv)这种写法好像是不能得到正确答案。

希望各位高人指点
二维码

扫码加我 拉你入群

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

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

关键词:rantbl RAN Ant 有没有 data步 格式 向量 缩写 rantbl

回帖推荐

bobguy 发表于4楼  查看完整内容

This is really fast one. You may see my post for efficient random generation in IML. Here is an example for rantbl. proc iml; call randseed(67); x=j(50000,1); p={0.1,0.2,0.3,0.4}; print p; call randgen(x, 'Table',p); create t1 from x; append from x; quit; proc freq data=t1; table col1; run;

本帖被以下文库推荐

沙发
milanxiaoyao 发表于 2011-12-24 04:31:40
lz 你的问题解决了吗,我也想知道结果

藤椅
jingju11 发表于 2011-12-24 11:38:46
is it possible to get a long string scalar first by concatenation and then make it into a macro variable then add it to the function arguments?

jingju

板凳
bobguy 发表于 2011-12-26 14:05:10
This is really fast one. You may see my post for efficient random generation in IML. Here is an example for rantbl.

proc iml;
call randseed(67);
x=j(50000,1);
p={0.1,0.2,0.3,0.4};
print p;
call randgen(x, 'Table',p);
create t1 from x;
append from x;
quit;

proc freq data=t1;
table col1;
run;
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

报纸
bobguy 发表于 2011-12-26 14:05:52
bobguy 发表于 2011-12-26 14:05
This is really fast one. You may see my post for efficient random generation in IML. Here is an exam ...
Here is the link.

https://bbs.pinggu.org/thread-1125188-1-1.html

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 16:39