Annita
Annita

Reputation: 1

creating a stratified sample in SAS with known stratas

I have a target population with some characteristics and I have been asked to select an appropriate control based on these characteristics. I am trying to do a stratified sample using SAS base but I need to be able to define my 4 starta %s from my target and apply these to my sample. Is there any way I can do that? Thank you!

Upvotes: 0

Views: 1320

Answers (1)

India.Rocket
India.Rocket

Reputation: 1245

To do stratified sampling you can use 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;

Hope this helps:-)

Upvotes: 2

Related Questions