SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hyunjeehale
Calcite | Level 5

I am needing to develop a randomization table using stratified block randomization with proportional allocation for an outside group to use. We know the general population proportions among the sample we are screening participants from for the two strata variables we want to use.

 

Treatment groups: 3

Strata 1: 2 levels (proportions of each level: 50%, 50%)

Strata 2: 3 levels (proportion of each level: 17%, 36%, 47%)

 

Total participants: 30,000

 

I have been using PROC PLAN to develop my randomization table, but could not find a solution that allowed me to account for the proportional breakdown of each strata. I found some references for PROC SURVEYSELECT and proportional allocation, however I could not find a way to incorporate blocks.

 

Using PROC PLAN, I am able to generate a randomization table of most of what I need, but the treatment groups are distributed evenly across the unique strata combination

What I get:

Treatment 1 (same for treatments 2 and 3)

                  Strata 2

                   Level 1       Level 2         Level 3

Strata 1

Level 1        1680         1680              1680

Level 2        1680         1680               1680

 

What I Need

Treatment 1 (same for treatments 2 and 3)

                  Strata 2

                   Level 1       Level 2         Level 3

Strata 1

Level 1        571        1210              1579

Level 2        571         1210               1579

 

 

Thank you for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

See if this come close to what you want:

data want;
   set have;
   strata1 = rand('table',.5,.5);
   strata2 = rand('table',.17,.36,.47);
run;

The rand('table') function uses a list of proportions to randomly assign values of 1 , 2, 3 etc depending upon how many parameters are used. Since it is random you may not get exactly the number of records per cell though with large data set and not really small percentages you should get close. If not close enough re-run until they are .

 

View solution in original post

1 REPLY 1
ballardw
Super User

See if this come close to what you want:

data want;
   set have;
   strata1 = rand('table',.5,.5);
   strata2 = rand('table',.17,.36,.47);
run;

The rand('table') function uses a list of proportions to randomly assign values of 1 , 2, 3 etc depending upon how many parameters are used. Since it is random you may not get exactly the number of records per cell though with large data set and not really small percentages you should get close. If not close enough re-run until they are .

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1792 views
  • 0 likes
  • 2 in conversation