LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Jul 2008 09:01:27 -0500
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: How to create all possible response patterns?
Comments: To: "Kevin F. Spratt" <Kevin.F.Spratt@DARTMOUTH.EDU>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
              reply-type=response

Getting the number of permutations and then running it through Proc Plan will do this; I believe you'd want both parameters to be 3 rather than one to be 2.

%let c = %sysfunc(perm(3,2)); %put &c;

ods output Plan=out_set; proc plan; factors Block=&c2 ordered Treat=2 of 3 perm; run;

-Mary ----- Original Message ----- From: Kevin F. Spratt To: SAS-L@LISTSERV.UGA.EDU Sent: Tuesday, July 15, 2008 8:06 AM Subject: How to create all possible response patterns?

Suppose I have a 3 item survey.

Each item can have a value of 1, 2, or 3.

If I wanted to create all possible response patterns in this case the possible patterns are 3^3 = 27

1 1 1 1 1 2 1 1 3 1 2 1 1 2 2 1 2 3 1 3 1 1 3 2 1 3 3 2 1 1 2 1 2 2 1 3 2 2 1 2 2 2 2 2 3 2 3 1 2 3 2 2 3 3 3 1 1 3 1 2 3 1 3 3 2 1 3 2 2 3 2 3 3 3 1 3 3 2 3 3 3 ;

How do I automate this process in a fashion that scales to the case where the number of items is 10, thus generating 3^10 unique patterns?

I thought that there may be an SQL general solution, where you create 10 data sets each having a single variable (item name) with the full range of choices, but I have not been able to successfully create this table.

As always, any help appreciated.

I'm running 9.1.3 on Windows XP today, 9.2 tomorrow!

______________________________________________________________________

Kevin F. Spratt, Ph.D. Department of Orthopaedic Surgery Dartmouth Medical School One Medical Center Drive DHMC Lebanon, NH USA 03756 (603) 653-6012 (voice) (603) 653-6013 (fax) Kevin.F.Spratt@Dartmouth.Edu (e-mail) _______________________________________________________________________


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