Hello! I am wondering if anyone has an answer on how I can randomize the order of one variable within strata. So, I used proc plan to create 3 randomization lists stratified by clinic and cancer stage (10 strata) in blocks of 2, 4, and 8. I merged the 3 lists into 1, but now within each strata, the blocks are ordered by all the blocks of 2, all the blocks of 4, and all the blocks of 8. I somehow want to randomize the order of the blocks within each strata. Can anyone help me with this? Each block has its own number, so I can see that they are ordered chronologically. Thank you!
Posting data as working data step will, most likely, increase quantity and quality of the answer given by the community.
So this is untested code:
data ordered;
set have;
new_position = rand('uniform');
run;
proc sort data=ordered out=want;
by identifying_number new_position;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.