1 2 3 0.354 0.222 -1.21
1 2 4 0.665 2.00 -0.05
....
其中(i1,x1)对应了一列数据(i,x)。。。
我的目标最后是要检验已有数据have的对称程度,而triples只是其中permutation计算所需要的。。。(also called distribution-free symmetry test)作者: shiyiming 时间: 2011-2-1 14:37 标题: Re: 请教:TRIPLES to jingju11
easy, man
[code:xyu6fc2j]
data triple;
array _x{5000} _temporary_;
array _x2{3} x1-x3;
if _n_=1 then
do i1=1 to ntotal;
set have nobs=ntotal;
_x[i1]=x;
end;
do i1=1 to dim(_x)-2;
do i2=i1+1 to dim(_x)-1;
do i3=i2+1 to dim(_x);
_x2[1]=_x[i1]; _x2[2]=_x[i2]; _x[3]=_x[i3];
output;
end;
end;
end;
run;
[/code:xyu6fc2j]
not tested yet作者: shiyiming 时间: 2011-2-1 14:46 标题: Re: 请教:TRIPLES to jingju11
奥利奥生成的数据集可以用来做为取数的索引。可以预先生成一系列的中间数据集,以后都用来做索引,多好啊。作者: shiyiming 时间: 2011-2-2 00:09 标题: Re: 请教:TRIPLES 谢谢。
我用5个观测的数据去测试,发现你的输出数据集有20个观测。据我的理解应该有10个观测。也不知道其中的原因?作者: shiyiming 时间: 2011-2-2 03:26 标题: Re: 请教:TRIPLES to jingju11
sorry, pls add "STOP;" right before "RUN;" statement, like:
[code:26c0p1if]
data have;
do i=1 to 5;
x=ranuni(0);
output; drop i;
end;
run;
data triple;
array _x{5} _temporary_ ;
array _x2{3} x1-x3;
if _n_=1 then
do k=1 to ntotal;
set have nobs=ntotal;
_x[k]=x;
end;
do i1=1 to dim(_x)-2;
do i2=i1+1 to dim(_x)-1;
do i3=i2+1 to dim(_x);
_x2[1]=_x[i1]; _x2[2]=_x[i2]; _x2[3]=_x[i3];
drop k x;
output;
end;
end;
end;
stop;
run;
[/code:26c0p1if]作者: shiyiming 时间: 2011-2-4 00:27 标题: Re: 请教:TRIPLES 首先祝大家春节快乐。
谢谢oloolo。你的程序很好。如果data 是1000, 差不多两三分钟即可。只是如果观测数增加到5000, 运行一段时间之后,程序结束报告:资源不足。我自己的用set的random access也大致差不多的结局。我的困惑是,如果做有选择的output,有可能成功吗?也就是说,output的过程占用I/O, CPU , MEMORY?哪一个呢?如果只是占用cpu,考虑output与否显然是没有意义的。谢谢。作者: shiyiming 时间: 2011-2-4 09:04 标题: Re: 请教:TRIPLES to jingju11
估计跟内存,CPU 没啥关系,主要怕是你的磁盘空间不够了,如果在server上,会不会被admin给干预了?
因为你的3个id都是1--5000的小整形数,设定他们的长度为4,而不是默认的8;如果闲麻烦,直接compress=binary应该有效
另外只保留你要的数据
5000个的话你这个配下来可是200多亿条的记录数作者: shiyiming 时间: 2011-2-4 23:15 标题: Re: 请教:TRIPLES 如果output所有的数据是不现实的,那么也许我应该在输出之前算出所需要的统计量了。作者: shiyiming 时间: 2011-2-5 06:39 标题: Re: 请教:TRIPLES to jingju11
I guess the total size of the output file would be:
N=(20820835000*(3*8+3*4))/1024/1024/1024~=698GB?
correct me if my calculation is wrong
you can try DATA _null_ first to obtain a ball park estimate on how long it will take.