samedi 4 novembre 2023

Randomization code with unequal allocation ratio

I have 60 patients, 5 cohorts where in each there are 4 female and 8 male. In each cohort the allocation ratio for female is (3:1) so 3 treatment and 1 placebo. And for male is (6:2) so 6 treatment and 2 placebo. Cohort 1 has the 150 mg dose Cohort 2 has 200 mg Cohort 3 has 250 mg Cohort 4 is "optional treatment" Cohort 5 is "optional treatment"

I need to create a randomization code in a way that the final output looks like below:

                          ## Cohort 1 - 150 mg ##
                               ## Female ##
Randomization number Treatment
101 Treatment
102 Placebo
103 Treatment
104 Treatment
                          ## Cohort 1 - 150 mg ##
                               ## Female ##
Treatment Count
Treatment 3
Placebo 1
                             Cohort 1 - 150 mg
                               ## Male ##

| Randomization number | Treatment | | -------- | -------------- | | 105 | Treatment | | 106 | Treatment | | 107 | Treatment | | 108 | Placebo | | 109 | Treatment | | 110 | Treatment | | 111 | Treatment | | 112 | Placebo | ## Cohort 1 - 150 mg ## ## Male ##

Treatment Count
Treatment 6
Placebo 2
                          ## Cohort 2 - 200 mg ##
                               ## Female ##
Randomization number Treatment
201 Treatment
202 Treatment
203 Treatment
204 Placebo
                          ## Cohort 2 - 200 mg ##
                               ## Female ##
Treatment Count
Treatment 3
Placebo 1
                             Cohort 2 - 200 mg
                               ## Male ##
Randomization number Treatment
205 Placebo
206 Treatment
207 Treatment
208 Placebo
209 Treatment
210 Treatment
211 Treatment
212 Treatment
                          ## Cohort 2 - 200 mg ##
                               ## Male ##
Treatment Count
Treatment 6
Placebo 2

. . . Up to cohort 5:

                          ## Cohort 5 - Optional dose ##
                               ## Female ##
Randomization number Treatment
501 Treatment
502 Treatment
503 Placebo
504 Treatment
                          ## Cohort 5 - Optional dose ##
                               ## Female ##
Treatment Count
Treatment 3
Placebo 1
                             Cohort 5 - Optional dose
                               ## Male ##
Randomization number Treatment
505 Treatment
506 Treatment
507 Treatment
508 Treatment
509 Treatment
510 Treatment
511 Placebo
512 Placebo
                          ## Cohort 1 - Optional dose ##
                               ## Male ##
Treatment Count
Treatment 6
Placebo 2

then I need to create a pdf output, an excel output and the sas output. In addition, I want a pdf output in a way that each randomization number for each male and female and the allocated treatment/placebo be printed separately on each pdf page.

I also need the same exact output but with the following randomization number (where in the title for each page, a "replacement" will be added):

Female cohort 1: 181 182 183 184 Male cohort 1: 185 186 187 188 189 190 191 192

Female cohort 2: 281 282 283 284 Male Cohort 2: 285 286 287 288 289 290 292 292

up to cohort 5: 581,...,585 (female) 585,...,592 (male)

Which I am having hard time creating them as I am not familiar with SAS programming at all. This is what I worked on so far but the problem is I could only do it for the equal number of male and female in each cohort and I cannot separate them in a way that in one pdf page I get female and the next page male (like the above output) and also having hard time creating the randomization number as above.

options ls=132 ps=58 nodate nonumber; title1 "RANDOMIZATION SCHEDULE"; title2 "A Randomized, Double-Blind, Placebo-Controlled, MAD Study";
%let seed=9683473;
data rannum(keep=seed);
  do i=1 to 5;
   rannum=ranuni(&seed);
   seed=int(rannum*1000000);
   output;
end; run;
proc sql noprint;
  select seed
    into :seed1 - :seed5
    from rannum;
quit;
proc format;

  value sex   1='Female'
              2='Male';
  value treat 1='Placebo'
              2='150 mg'
              3='200 mg'
              4='250 mg'
              5='optional dose'
              6='optional dose';
run;

proc plan seed=&seed1;
  factors sex=2  treat=12 /noprint;
  output out=data1
         sex nvals=(1 2) random
         treat nvals=(1 1 2 2 2 2 2 2)
random;
run;
proc plan seed=&seed2;
  factors  sex=2  treat=12 /noprint;
  output out=data2
         sex nvals=(1 2) random
         treat nvals=(1 1 3 3 3 3 3 3)
random;
run;

proc plan seed=&seed3;
  factors  sex=2  treat=12 /noprint;
  output out=data3
         sex nvals=(1 2) random
         treat nvals=(1 1 4 4 4 4 4 4)
random;
run;

proc plan seed=&seed4;
  factors  sex=2  treat=12 /noprint;
  output out=data4
         sex nvals=(1 2) random
         treat nvals=(1 1 5 5 5 5 5 5)
random;
run;

proc plan seed=&seed5;
  factors  sex=2  treat=12 /noprint;
  output out=data5
         sex nvals=(1 2) random
         treat nvals=(1 1 6 6 6 6 6 6)
random;
run;

%macro combine(dataset);
 %do i=1 %to 5;
   %let dataset=data&i;
   proc sort data=&dataset; by sex;
   data &dataset;
     set &dataset;
     cohort=&i;
     subid=%eval(&i.00)+(_n_);
%end; %mend;
%combine
data combine;
  set data1 data2 data3 data4 data5
run;

proc sort; by cohort sex;

print data=combine noobs double
proc
uniform split='*';
var sex subid treat;
id cohort;
by cohort;
label subid="Randomization number"
treat="TREATMENT";
format  treat treat.;
run;



Aucun commentaire:

Enregistrer un commentaire