BookmarkSubscribeRSS Feed
noda6003
Quartz | Level 8

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

 

3 REPLIES 3
Kurt_Bremser
Super User

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;
FreelanceReinh
Jade | Level 19

@Kurt_Bremser: I think you mean the 'uniform' distribution, not the 'normal' distribution (for an allocation ratio of 1:1).

andreas_lds
Jade | Level 19

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1325 views
  • 0 likes
  • 4 in conversation