Hi,
I want to create a dummy randomisation list to randomly assign 2 treatments for pat id's. i found many examples but if i get a new pat id then the program should randomly assign one treatment and not change the existing treatment groups. is there any existing program which does or an example would be appreciated. assigning trt A and trt B like below
pat_id trt
101 trt A
102 trt B
103 trt B
104 trt A
Keep a dataset with the existing values, and randomize only the new ones:
data have;
infile cards dlm=',';
input pat_id $ trt $;
cards;
101,trt A
102,trt B
103,trt B
104,trt A
;
run;
data add;
input pat_id $;
cards;
105
;
run;
data want;
set
have
add
;
if trt = '' then trt = ifc(rand('normal',1) > .5,'trt A','trt B');
run;
@Kurt_Bremser: I think you mean the 'uniform' distribution, not the 'normal' distribution (for an allocation ratio of 1:1).
How do you get a new patient?
Without knowing the program you use for the initial assignment of treatments, it is hardly possible to suggest something useful, except for the most obvious: exclude the observations with non-missing trt variable when assigning trt.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.