全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2237 3
2014-04-09
%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条左右的数据,哪位大神能给我解释一下呀。

二维码

扫码加我 拉你入群

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

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

全部回复
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
二维码

扫码加我 拉你入群

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

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

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
二维码

扫码加我 拉你入群

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

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

2014-4-9 14:43:52
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%的方法么?
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群