2111 3

surveyselect过程步抽取出来的数据量与n不同 [推广有奖]

  • 0关注
  • 4粉丝

教授

12%

还不是VIP/贵宾

-

威望
0
论坛币
6752 个
通用积分
15.6910
学术水平
18 点
热心指数
24 点
信用等级
15 点
经验
407 点
帖子
1190
精华
0
在线时间
996 小时
注册时间
2013-1-20
最后登录
2024-4-1

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
%macro dabao(rate1,num)        ;
        %local seed=12345;
         %do simu_num= 1 %to 1000;
         %let seed2=%eval(&seed + &simu_num);
                proc surveyselect data=birth_data
                                                        method=urs
                                                        out=sample&simu_num.
                                                        n=&num.
                                                        seed=&seed2.;
                        id subject_id birth_weight;
                run;
        %end;
%mend;
%dabao(num=3588)
birth_data里面有3987条数据。我按照以上的程序来抽取3588条数据,最后只能得到2700条左右的数据,哪位大神能给我解释一下呀。

二维码

扫码加我 拉你入群

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

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

关键词:surveyselect Surveys Select Survey Elect

沙发
jingju11 发表于 2014-4-9 12:04:39 |只看作者 |坛友微信交流群
URS is to request sampling data with replacement. that is, one record could be sampled multiple times. So, the variable NUMBERHITS in the output dataset can be of value >1. If you want to display one record for each hit, specify OUTHITS options in SURVEYSELECT statement.
JingJu

使用道具

藤椅
jingju11 发表于 2014-4-9 12:11:30 |只看作者 |坛友微信交流群
jingju11 发表于 2014-4-9 12:04
URS is to request sampling data with replacement. that is, one record could be sampled multiple time ...
By the way, the code is not good for the three reasons :( 1) macro makes the code not efficient. You can use rep= option to do repeated sampling, (2) using different seeds to ensure independent sampling is not reliable, and even erroneous, (3) generating so many datasets makes the program ugly and thus not efficient.
JingJu

使用道具

jingju11 发表于 2014-4-9 12:11
By the way, the code is not good for the three reasons :( 1) macro makes the code not efficient. ...
您的意见真的很好,第一个和第三个我可以改进的,第二个需要用什么来实现可靠地随机抽样呢?可以用生成随机数对随机数进行排列,然后取前面90%的方法么?

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 03:00