【问题标题】:creating a stratified sample in SAS with known stratas在 SAS 中创建具有已知层的分层样本
【发布时间】:2017-09-08 01:26:47
【问题描述】:

我有一个具有某些特征的目标人群,我被要求根据这些特征选择适当的控制。我正在尝试使用 SAS 基础进行分层样本,但我需要能够从我的目标定义我的 4 starta %s 并将这些应用于我的样本。有什么办法可以做到吗?谢谢!

【问题讨论】:

标签: sas statistical-sampling


【解决方案1】:

要进行分层抽样,您可以使用PROC SURVEYSELECT

Here is an example:-

/*Dataset creation*/

data data_dummy;
input revenue revenue_tag Premiership_level;
   datalines;
1000 High 1
90 Low 2
500 Medium 3
1200 High 4
;
run;


/*Now you need to Sort by rev_tag, Premiership_level (say these are the 
 variables you need to do stratified sampling on)*/
proc sort data = data_dummy;
by rev_tag  Premiership_level;
run;



/*Now use SURVEYSELECT to do stratified sampling using 10% samprate (You can 
change this 10% as per your requirement)*/

/*Surveyselect is used to pick entries for groups such that , both the 
  groups created are similar in terms of variables specified under strata*/

     proc surveyselect data=data_dummy method = srs samprate=0.10
     seed=12345 out=data_control;
     strata rev_tag  Premiership_level;
     run;

/*Finally tag (if you want for more clarity) your 10% data as control 
group*/
     Data data_control;
     Set data_control;
     Group = "Control";
     Run;

希望这会有所帮助:-)

【讨论】:

  • 谢谢!不过,在选择了目标群体后,我被要求这样做。我不认为我可以在 SAS 中做到这一点?插入某些特征的百分比,然后让 SAS 根据这些百分比对总体进行抽样?非常感谢您的回答非常有帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-13
  • 2019-03-11
  • 1970-01-01
相关资源
最近更新 更多