Date: Wed, 14 May 2008 17:33:07 -0500 "data _null_," "SAS(r) Discussion" "data _null_," Re: Proc PLAN to generate Combinations? To: Mary <00cf01c8b610\$8823d200\$832fa8c0@HP82083701405> text/plain; charset=ISO-8859-1

The COMB function may be some help also. Consider...

%let n = 78; %let r = 2; %let c = %sysfunc(comb(&n,&r)); %put _user_; proc plan ordered; factors c=&c t=&r of &n comb; output out=plan; run; quit;

On 5/14/08, Mary <mlhoward@avalon.net> wrote: > I figured it out, thanks (sometimes I just need a question out on SAS-L to answer :-). The trick is that you have to have the number of the entire number of combinations: > > title 'All Combinations of (78 Choose 2) Integers'; > > ods output Plan=Combinations; > > proc plan; > > factors Block=3003 ordered Treat= 2 of 78 comb; > > run; > > proc print data=Combinations noobs; > > run; > > /* 78!/(2!78-2!)=3003 */ > > > > -Mary > > ----- Original Message ----- > From: Mary > To: SAS-L@LISTSERV.UGA.EDU > Sent: Wednesday, May 14, 2008 5:07 PM > Subject: Proc PLAN to generate Combinations? > > > Has anyone used Proc Plan to produce combinations? For instance, say I want every two-combinations of 78 numbers, like this: > > 1, 2 > 1, 3 > 1, 4 > ... > 2, 3 > 2, 4 > ... > 2,78 > ... > 77,78 > > I tried to use this code for combinations, but it is only producing one line: > > proc plan; > > factors t=2 of 78 comb; > > run; > > > > What am I missing to get all possible combinations of 78 choose 2? > > > > -Mary >

Back to: Top of message | Previous page | Main SAS-L page