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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.