我查的书里有这样的缩写格式:
array p{*} p1-pn;
rantbl(seed, of p{*} );
但是这就要求在data步里实现。
我写了一个程序在之前都是使用iml的,程序要求按照某个固定的概率向量取一些随机数。
比如我得到了一个向量pv,这里pv是一列数(当然都是概率啦)。请问有没有什么缩写方式可以在iml里能让rantbl直接使用这个pv呢?
我试的rantbl(seed,pv)这种写法好像是不能得到正确答案。
希望各位高人指点

|
楼主: xuantai
|
2330
4
rantbl有没有比较好的向量缩写格式啊? |
|
小学生 42%
-
|
回帖推荐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;
本帖被以下文库推荐
| ||
|
|
| ||
| ||
| ||
| ||
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


