|
If you have version 9 you could use some thing like this from the help
docs:
data _null_;
array x [4] $3 ('ant' 'bee' 'cat' 'dog');
n=dim(x);
nfact=fact(n);
do i=1 to nfact;
call allperm(i, of x[*]);
put i 5. +2 x[*];
end;
run;
if you don't take Ron's suggestion and look at the extensive archives on
permutations.
HTH
Toby Dunn
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Fehd, Ronald J. (PHPPO)
Sent: Friday, June 25, 2004 1:03 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: arrangements of indistinguishable objects?
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Suppose I have 6 objects, 3 of type A and 3 of type B, and
> would like to arrange them randomly. I would like to make an
> array of all the possible arrangements. So for example one
> element of the array might be AABBAB. Can anyone suggest an
> easy way of doing this? I was thinking of tweaking the code
> http://www.id.unizh.ch/software/unix/statmath/sas/sasdoc/stat/
chap50/sec
t23.htm but being a SAS newbie I wasn't sure how to go about it - any
suggestions would be appreciated.
round flat thing with hole in the middle:
been threaded here many times before:
check our most excellent archives:
http://www.listserv.uga.edu/archives/sas-l.html
search for: combination or permutation
subject contains:
author's address:
since:
until:
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
|