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: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1271 views
  • 0 likes
  • 4 in conversation