由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - [Teradata] How to randomly select one observation from each group?
相关主题
In sas, how do you randomly pick 10 numbers out of 29?SAS sampling的问题
请教如何用SAS处理这个RANDOM SAMPLING的问题谁用过surveyselect 啊, 救我啊
Help on understanding how to Creating a Random Sample without Replacement读入SAS data set的问题
菜鸟问个sas得问题,关于分数组proc sql如何随机选择数据。ranuni
如何在1,2,3,4,5中随机选出2个数来?有谁熟习用SAS做RANDOM SAMPLING, 请教!
用SAS sampling的一个问题A question in splitting dataset
如何用SAS 生成一个组合变量?[合集] how to randomly draw 10% sample from a data set?
~~~~~~~~~~~~~~ proc surveyselect 究竟怎样选样本的?SAS random number generatior该怎么用呀?
相关话题的讨论汇总
话题: teradata话题: randomly话题: group话题: select
进入Statistics版参与讨论
1 (共1页)
s*********h
发帖数: 6288
1
I want to select randomly one observation from each group_id.
If it can be done in subqueries, it's even better.
Thanks.
c****0
发帖数: 14490
2
是指一组数按group_id可以分为几个小组,然后你要在每个小组中randomly选一个obs
吗?
如果是,
说下想法,顺便等高手指正
1.用stata
sample 1,by group_id
2.用sas
PROC SURVEYSELECT DATA=temp;
STRATA variables; *这里的STRATA 变量要先sort过
3.如果取一些数,也可以考虑create new random variable,一般我用 random=ranuni
(n);然后sort random或者设条件取sample

【在 s*********h 的大作中提到】
: I want to select randomly one observation from each group_id.
: If it can be done in subqueries, it's even better.
: Thanks.

s*********h
发帖数: 6288
3
多谢回帖。
但是我想在teradata里面完成,不借用其他统计软件。

obs
ranuni

【在 c****0 的大作中提到】
: 是指一组数按group_id可以分为几个小组,然后你要在每个小组中randomly选一个obs
: 吗?
: 如果是,
: 说下想法,顺便等高手指正
: 1.用stata
: sample 1,by group_id
: 2.用sas
: PROC SURVEYSELECT DATA=temp;
: STRATA variables; *这里的STRATA 变量要先sort过
: 3.如果取一些数,也可以考虑create new random variable,一般我用 random=ranuni

b*********n
发帖数: 2975
4
use sample 1 after your code
or generate random number function and order it and top 1 like SAS did

I want to select randomly one observation from each group_id.
If it can be done in subqueries, it's even better.
Thanks.

【在 s*********h 的大作中提到】
: I want to select randomly one observation from each group_id.
: If it can be done in subqueries, it's even better.
: Thanks.

c****0
发帖数: 14490
5
哦,没看清teredata,咳咳~那个木有用过,╮(╯﹏╰)╭
加油!

【在 s*********h 的大作中提到】
: 多谢回帖。
: 但是我想在teradata里面完成,不借用其他统计软件。
:
: obs
: ranuni

s*********h
发帖数: 6288
6
this is a good way. Thanks.
BTW, is it efficient? I was hoping there is a generic way of doing it.

【在 b*********n 的大作中提到】
: use sample 1 after your code
: or generate random number function and order it and top 1 like SAS did
:
: I want to select randomly one observation from each group_id.
: If it can be done in subqueries, it's even better.
: Thanks.

b*********n
发帖数: 2975
7
sample 1 is from teradata itself, should very efficient,
however, if you want to have a very good random generator, you may try some
numerical libary by Fortran/C++ and then
insert the generated random value into your table, then top 1
it also not a big deal for teradata

this is a good way. Thanks.
BTW, is it efficient? I was hoping there is a generic way of doing it.

【在 s*********h 的大作中提到】
: this is a good way. Thanks.
: BTW, is it efficient? I was hoping there is a generic way of doing it.

1 (共1页)
进入Statistics版参与讨论
相关主题
SAS random number generatior该怎么用呀?如何在1,2,3,4,5中随机选出2个数来?
请教一个SAS 数据分配问题用SAS sampling的一个问题
how to generate 1 to 100k random integer numbers without zeros?如何用SAS 生成一个组合变量?
请教一个sas问题~~~~~~~~~~~~~~ proc surveyselect 究竟怎样选样本的?
In sas, how do you randomly pick 10 numbers out of 29?SAS sampling的问题
请教如何用SAS处理这个RANDOM SAMPLING的问题谁用过surveyselect 啊, 救我啊
Help on understanding how to Creating a Random Sample without Replacement读入SAS data set的问题
菜鸟问个sas得问题,关于分数组proc sql如何随机选择数据。ranuni
相关话题的讨论汇总
话题: teradata话题: randomly话题: group话题: select