sas >> Permuted Block Randomization with PROC PLAN

by Haris » Wed, 28 Mar 2007 09:42:36 GMT

I've been trying to generate a randomization schedule for permuted-
block randomization schedule and am having no luck with PROC PLAN. I
did it manually before, but was hoping for simplification.

I am looking to assign patients in a randomized multi-site trial to
two treatments (1 and 2). The plan calls for permuted-block
randomization with 2, 4 and 6 patients per block. A condition is
imposed where within each block, equal number of patients gets
assigned to each group, e.g. 1,1,2,2 in the block of 4 or 1,1,2,2,1,2
in the block of 6.

First, each site gets assigned multiple of block orders first. There
are six possible combinations of the three block sizes and each
triplet is good to randomize 12 patients. Let's say that I need to
randomize 120 patients which means that I need 10 random 3-block-size
orders per site. I think I can figure out how to do this part in PROC
PLAN on my own.

Next, I need to randomly fill in the actual treatment assignment
within each block. There are only two orders for the block of two
(1,2 and 2,1), 6 permutations in the block of 4 etc. So if the first
random block-order is 2-4-6, I need to randomly pick 1,2 or 2,1 for
block of 2; 1122, 2211,1221, 2112, 1212, or 2121 for block of 4, etc.
Is there a way to fill these values into a neat table with Proc PLAN?



sas >> Permuted Block Randomization with PROC PLAN

by Haris » Thu, 29 Mar 2007 02:39:55 GMT


Here's what I had to resort to in order to accomplish the task:


/* Generate random numbers for:
/* 1. Block orders (2, 4, and 6 subjects)
/* 2. Assignment orders within blocks of different sizes
/****************************************************************/
proc plan seed=32807;
factors Site = 100 ordered
Block = 10 ordered
BlockO = 1 of 6
Two = 1 of 2
Four = 1 of 6
Six = 1 of 18 ;
output out=a Two cvals=('EC' 'CE')
Four cvals=('EECC' 'ECEC' 'ECCE' 'CEEC' 'CECE' 'CCEE')
Six cvals=('EECECC' 'EECCEC' 'EECCCE'
'ECEECC' 'ECECEC' 'ECECCE'
'CEEECC' 'CEECEC' 'CEECCE'
'ECCEEC' 'ECCECE' 'ECCCEE'
'CECEEC' 'CECECE' 'CECCEE'
'CCEEEC' 'CCEECE' 'CCECEE') ;

/* Join within-block randomization assignments */
/* and random within-block orders */
data b ;
retain Site Block Order ;
length Order $12. ;
set a ;
if BlockO=1 then Order=cats(Two, Four, Six) ;
if BlockO=2 then Order=cats(Two, Six, Four) ;
if BlockO=3 then Order=cats(Four, Two, Six) ;
if BlockO=4 then Order=cats(Four, Six, Two) ;
if BlockO=5 then Order=cats(Six, Two, Four) ;
if BlockO=6 then Order=cats(Six, Four, Two) ;
keep Site Block Order ;

/* Transpose the file to create one record per site */
proc transpose data=b out=c (drop=_name_) Prefix=Block ;
var Order ;
by Site ;

/* Concatenate 10 randomization blocks */
/* into a single string of group assignments */
data d ;
retain Site Order ;
length Order $131. ;
set c ;
Order = catx (' ', of Block1-Block10) ;
drop Block1--Block10 ;
run ;

I wonder if there is an easier way.




sas >> Permuted Block Randomization with PROC PLAN

by datanull » Thu, 29 Mar 2007 20:20:31 GMT

don't have anything to offer. But I have a question. If the
sequences 'EECC' and 'CCEE' are good then why not 'EEECCC','CCCEEE'.
When I use a program to compute the sequences I get 20 for the number
of sequences for block size 6.

data work.p4;
array _p[4] $1 ('E' 'E' 'C' 'C');
length seq $16.;
do _n_=1 to fact(dim(_p));
call allperm(_n_, of _p[*]);
seq = cats(of _p[*]);
output;
end;
keep seq;
run;
proc sort nodupkey force;
by seq;
run;
proc print;
run;

data work.p6;
array _p[6] $1 ('E' 'E' 'E' 'C' 'C' 'C');
length seq $16.;
do _n_=1 to fact(dim(_p));
call allperm(_n_, of _p[*]);
seq = cats(of _p[*]);
output;
end;
keep seq;
run;
proc sort nodupkey force;
by seq;
run;
proc print;
run;
data work.control;
fmtname = 'BS4_'; /*block size 4*/
type = 'N';
length start 8 label $40;
do until(eof);
set work.p4 end=eof;
start + 1;
label = seq;
output;
end;
eof = 0;
fmtname = 'BS6_'; /*block size 6*/
start = 0;
do until(eof);
set work.p6 end=eof;
start + 1;
label = seq;
output;
end;
stop;
run;
proc format fmtlib cntlin=control;
run;

On 3/28/07, Haris < XXXX@XXXXX.COM > wrote:


Permuted Block Randomization with PROC PLAN

by Haris » Thu, 29 Mar 2007 23:23:20 GMT

You are correct, _null_, but we decided that 6 patients in a row
potentially going to the same group was too much and did not use
permutations CCCEEE and EEECCC.

Really fancy code, though :)



Permuted Block Randomization with PROC PLAN

by elodie » Sat, 20 Feb 2010 05:42:36 GMT

Hi everyone,

I have been trying to generate a randomization schedule for permuted-
block randomization schedule and am having no luck with PROC PLAN. I
did it manually before, but was hoping for simplification.

I am looking to assign 60 patients in a randomized trial to two
treatments (1 and 2). The plan calls for permuted-block randomization
with 6 patients per block.

A condition is imposed where the two treatments are balanced within
three disease stage groups as well as overall.

It is the first time I use proc plan, and my syntax is pretty useless
at this point. I would appreciate it if someone could give me some
help.

proc plan seed=32807;
factors block=10 ordered cancerstage=3 ;
treatments treatment=3 random;*/
run;
quit;

Thanks a lot in advance.


Permuted Block Randomization with PROC PLAN

by data _null_; » Sat, 20 Feb 2010 06:22:26 GMT




If I understand correctly this is RCB with 2 treatments. Three
plots(subjects) per trt per block, for 6 plots per block.

If so I believe this PROC PLAN will suffice.

proc plan seed=32807;
factors block=10 ordered treatment=6 i=1;
treatments subjid=1 of 60 perm;
output out=plan(drop=i) treatment cvals=('A' 'A' 'A' 'B' 'B' 'B');
run;
quit;
proc print;
by block;
id block;
run;


Permuted Block Randomization with PROC PLAN

by a » Sat, 20 Feb 2010 21:58:31 GMT




> actors block=10 ordered treatment=6 i=1; >> reatments subjid=1 of 60 perm;> > utput out=plan(drop=i) treatment cvals=('A' 'A' 'A' 'B' 'B' 'B')>
> u>;
> u>t;
> proc pri>t;
> y bl>ck;
> d b>ock;
> un;- Hide quoted >ex> -
>
> - Show quoted text -

The statements can be simplified such that the TREATMENTS statement is
not needed.

proc plan seed=32807;
factors block=10 ordered treatment=6 subjid=1 of 60 perm;
output out=plan treatment cvals=('A' 'A' 'A' 'B' 'B' 'B');
run;
quit;
proc print;
by block;
id block;
run;


Similar Threads

1. permuted block randomization using Proc Plan question

Dear all,

There are two treatments say A and B. I have to create the block such
that each of the first six investigator would randomly get one of the
following possible blocks. I have never used Proc Plan and i am sure
this could be done using proc plan. I would appreicate if someone can
help me on this.

A A B B
A B A B
A B B A
B B A A
B A B A
B A A B

There are all together around 36 patients per center and there are 60
centers. So the above sequence which is for the 6 centers and 4
patients needs to be created for 36 patients and 60 centers. So i
guess there would be total 10 set of 6 blocks each for each site. And
there would be 9 sets of vertical blocks for 36 patients per site.
Correct me if i am wrong. Do you mind helping me out generating this
randomization file?

Awating your reply,

2. PROC PLAN - Randomizing only two Treatments in a specified block size

3. block randomization

hi friends,
I am new to groups.I need some help in the randomization schedule
programming.
there are 200 patients divided among 3 sites and 2 treatment groups
and block size of 4 menas there should be 4 patients per block.How can
I do this usin proc pla.your help is really appreciated.
Thanks
sm

4. A Randomization-test Wrapper for SAS PROC - QUESTION

5. Permute rows and columns of a rectangular matrix according to similarity

Hi guys,

I have a rectangular matrix, approximately 2000x500, of response times
to test questions (actually the residuals after removing the row and
column effects). I want to permute the rows and columns of the matrix
so similar rows are adjacent and similar columns are adjacent. I don't
have access to SAS/IML (I almost wanted to call it Proc Matrix, talk
about old!). Does anyone have any suggestion for accomplishing my
goals?

I'm thinking of first clustering the rows and then the columns and
somehow using the ordering of the tree diagram, but a) I'm not sure
that's the best way and b) if it is the best way, I'm not sure which
clustering procedure and method to use. Having removed the main
effects, I have no reason to suspect the data are unidimensional.

Any suggestions, ideas or hints?

As always, thanks a lot for any help!

Barry Grau

6. Out of memory problem in proc plan

7. suppress the output when using Proc Plan

Hi sas-list,

I want to suppress the output when using Proc Plan

ods output Plan=Combinations;
proc plan;
 factors Block=&m ordered
         Treat= &k of &n comb;
run;

I only want to create the data set Combinations
which lists all combinations n choose k.
Here n=9, k=5:

Block Treat1 Treat2 Treat3 Treat4 Treat5
1     1      2      3      4      5
...

*ods output Plan=Combinations;
proc plan;
 factors Block=&m ordered
         Treat= &k of &n comb /noprint;
 output out=Combinations;
run;

produces only

Block Treat
1     1
...

What can I do?

Stefan.

8. Proc PLAN to generate Combinations?