【发布时间】:2015-06-11 00:28:14
【问题描述】:
我有一个简单的客户数据集(大约 40,000k) 它看起来像:
customerid, group, other_variable
a,blue,y
b,blue,x
c,blue,z
d,green,y
e,green,d
f,green,r
g,green,e
我想为每个组随机选择 Y 数量的客户(以及他们的其他变量)。 问题是,我想为每组随机选择两个 Y 数量 即
4000 random green customers split into two sets of 2000 randomly
and 4000 random blue customers split into two sets of 2000 randomly
这是因为我有不同的信息要给两个不同的拆分 我不是用替换抽样。需要成为独特的客户
更喜欢 PROC SQL 中的解决方案,但如果 proc sql 不合适,我很乐意在 sas 中使用替代解决方案
【问题讨论】:
-
也许这份文件 (pdf) 会有所帮助:www2.sas.com/proceedings/sugi31/168-31.pdf