hi all,
im not sure where to post this so ill start here.
i want to create an incomplete block design. i have 8 treatments A-H. i need to create 3 blocks of size 2.
now here is where im getting it stuck. there are treatment pairs that cannot be separated. in other words, A/B need to stay together, C/D, E/F, and G/H. so out of those four pairs i need to pick 3 pairs and i have to replicate this 50 times. i need all the pairs to be distributed equally and uniformly.
so for example replicate 1 may look like
Block 1 | Block 2 | Block 3 |
---|---|---|
A | E | C |
B | F | D |
replicate 2 would may like
Block 1 | Block 2 | Block 3 |
---|---|---|
E | A | C |
F | B | D |
any thoughts???
Since you haven't stated clearly if the order of treatments matters, so here is the combination version of the code. If it does matter, then use permutation version of it.
data _null_;
array x(4) $2 ('AB' 'CD' 'EF' 'GH');
seed = 1234567890123;
do n=1 to 50;
call rancomb(seed, 3, of x1-x4);
put seed= @20 ' x= ' x1-x3;
end;
run;
Haikuo
If the pairs can't be separated doesn't that mean you really only have 4 "treatments"?
Since you haven't stated clearly if the order of treatments matters, so here is the combination version of the code. If it does matter, then use permutation version of it.
data _null_;
array x(4) $2 ('AB' 'CD' 'EF' 'GH');
seed = 1234567890123;
do n=1 to 50;
call rancomb(seed, 3, of x1-x4);
put seed= @20 ' x= ' x1-x3;
end;
run;
Haikuo
Not only random permutations, but also ordered sets of permutations:
http://blogs.sas.com/content/iml/2010/10/13/generate-all-permutations-in-sas/
By the way, in SAS/IML software the ALLCOMB, ALLPERM, RANCOMB, and RANPERM functions work on arbitrary sets, not just integers 1:n.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.