0

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!

Annita
  • 1
  • 1
  • 1
    Possible duplicate of [SAS Change the Proportion of a Random Sample](http://stackoverflow.com/questions/36910853/sas-change-the-proportion-of-a-random-sample) – user667489 Apr 12 '17 at 10:50

1 Answers1

2

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:-)

PKumar
  • 10,971
  • 6
  • 37
  • 52
India.Rocket
  • 1,225
  • 1
  • 8
  • 11
  • Thank you! I was asked to do this after the target group was selected though. I don't suppose I can do that in SAS? Insert the % of certain characteristics and then let SAS sample a population based on these percentages? Your answer is very helpful though thank you very much! – Annita Apr 19 '17 at 12:17