全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1173 1
2011-12-05
用surveyselect 如何实现在不同分组,等比例无放回抽取?
二维码

扫码加我 拉你入群

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

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

全部回复
2011-12-6 11:57:18
Not exactly sure what do you want, but the surveyselect with strata certainly does help IMO. Here is an example.

data t1;
   do i = 1 to 1000;
      x=rannor(123)*3+5; type=1;
          output;
        end;

   do i = 1 to 500;
      x=rannor(123)*6+10; type=2;
          output;
        end;
        drop i;
        run;

proc surveyselect data=t1
      SAMPSIZE=50
      seed=4870192 out=Sample;
   strata Type ;
run;

proc means data=sample nway VARDEF=WGT;
class type;
var x;
weight samplingweight;
run;


proc surveyselect data=t1
      SAMPSIZE=(200 100)
      seed=4870192 out=Sample;
   strata Type ;
run;

proc means data=sample nway VARDEF=WGT;
class type;
var x;
weight samplingweight;
run;

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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