全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2287 4
2010-08-14
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)这种写法好像是不能得到正确答案。

希望各位高人指点
二维码

扫码加我 拉你入群

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

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

全部回复
2011-12-24 04:31:40
lz 你的问题解决了吗,我也想知道结果
二维码

扫码加我 拉你入群

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

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

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
二维码

扫码加我 拉你入群

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

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

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;
二维码

扫码加我 拉你入群

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

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

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
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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