|
Hi SPSS users,
For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? Thank you. Eins --------------------------------- New Email names for you! Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does! ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
For example this way:
INPUT PROGRAM. vector p (3). LOOP #id = 1 to 6 * 6 * 6. - compute p3 = mod(#id - 1, 6) + 1. - compute p2 = mod((#id - p3) / 6, 6) + 1. - compute p1 = mod((#id - 6*(p2-1) - p3) / (6 * 6), 6) + 1. - END CASE. END LOOP. END FILE. END INPUT PROGRAM. form all (f8). execute. Have a nice weekend, Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eins Bernardo Sent: Friday, October 31, 2008 1:45 PM To: [hidden email] Subject: listing permutations Hi SPSS users, For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? Thank you. Eins --------------------------------- New Email names for you! Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does! ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD _____________ Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem. Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu. This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission. Are you sure that you really need a print version of this message and/or its attachments? Think about nature. -.- -- ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by E. Bernardo
open a new instance of SPSS. Copy, Paste, and run the following sets of
syntax. * this program creates all possible permutations of 3 "dice" variables . new file. set seed = 20081031. input program. loop i = 1 to 6. loop j = 1 to 6. loop k = 1 to 6. leave i j k. end case. end loop. end loop. end loop. end file. end input program. formats i,j,k (f1). list. * this program "throws three dice" . set seed = 5743269. input program. vector die (3,f1). loop throw = 1 to 20. loop #k = 1 to 3. compute die(#k) = rnd(rv.uniform(1,6)). end loop. end case. end loop. end file. end input program. formats throw (f3) die1 to die3 (f1). list. Art Kendall Social Research Consultants Eins Bernardo wrote: > Hi SPSS users, > > For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? > > Thank you. > Eins > > > --------------------------------- > New Email names for you! > Get the Email name you've always wanted on the new @ymail and @rocketmail. > Hurry before someone else does! > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
|
In reply to this post by E. Bernardo
CORRECTION. CORRECTION. CORRECTION.
* this program "throws three dice" . *note arguments to rv.uniform. set seed = 5743269. input program. vector die (3,f1). loop throw = 1 to 2000. loop #k = 1 to 3. compute die(#k) = rnd(rv.uniform(.5,6.5)). end loop. end case. end loop. end file. end input program. formats throw (f3) die1 to die3 (f1). frequencies vars = die1 to die3. Art Eins Bernardo wrote: > Hi SPSS users, > > For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? > > Thank you. > Eins > > > --------------------------------- > New Email names for you! > Get the Email name you've always wanted on the new @ymail and @rocketmail. > Hurry before someone else does! > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
|
In reply to this post by Spousta Jan
Jan, thank you. Your syntax works but I am sorry, I used a wrong term. What I want is combination, not permutation. What to modify from your syntax to produce the combinations?
Thanks. Eins Spousta Jan <[hidden email]> wrote: For example this way: INPUT PROGRAM. vector p (3). LOOP #id = 1 to 6 * 6 * 6. - compute p3 = mod(#id - 1, 6) + 1. - compute p2 = mod((#id - p3) / 6, 6) + 1. - compute p1 = mod((#id - 6*(p2-1) - p3) / (6 * 6), 6) + 1. - END CASE. END LOOP. END FILE. END INPUT PROGRAM. form all (f8). execute. Have a nice weekend, Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eins Bernardo Sent: Friday, October 31, 2008 1:45 PM To: [hidden email] Subject: listing permutations Hi SPSS users, For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? Thank you. Eins --------------------------------- New Email names for you! Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does! ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD _____________ Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem. Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu. This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission. Are you sure that you really need a print version of this message and/or its attachments? Think about nature. -.- -- ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD --------------------------------- Get your preferred Email name! Now you can @ymail.com and @rocketmail.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Art Kendall
Hi Art,
Your syntax does not generate the permutations. I was wrong with the term I was using. It was supposed to be combination, not permutation. Anyway, just ignore the dice problem. Basically, I asked the combinations (not permutations) using "dice" as example because I want to apply it to my problem. The problem goes like this: Our school would like to offer a new training program with 8 attributes, each attribute with two levels. The following shows some of the attributes as well as the levels. ATTRIBUTE LEVEL Instruction type online, classroom schedule weekdays, weekends tuition below 1500, above 1500 Attribute 4 X, Y Attribute 5 W, Z Attribute 6 P, Q Attribute 7 M, N Attribute 8 R, S The main goal is to list all the possible combinations in a 9 column SPSS format. For example: Combination InstructionType Schedule Tuition Attribute4 ... 1 online weekdays <1500 X 2 online weekends >1500 Y 3 classroom weekdays <1500 X 4 classroom weekends >1500 Y This can be done in SPSS using the ORTHOGONAL DESIGN procedure. However, it generates only up to 99 combinations. It cannot generate all the possible combinations needed for my problem. I would be thankful and pleased for any help that somebody can extend. Eins Art Kendall <[hidden email]> wrote: CORRECTION. CORRECTION. CORRECTION. * this program "throws three dice" . *note arguments to rv.uniform. set seed = 5743269. input program. vector die (3,f1). loop throw = 1 to 2000. loop #k = 1 to 3. compute die(#k) = rnd(rv.uniform(.5,6.5)). end loop. end case. end loop. end file. end input program. formats throw (f3) die1 to die3 (f1). frequencies vars = die1 to die3. Art Eins Bernardo wrote: > Hi SPSS users, > > For the purpose of my question here, suppose we have three cubes (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS syntax to generate all the permutations? > > Thank you. > Eins > > > --------------------------------- > New Email names for you! > Get the Email name you've always wanted on the new @ymail and @rocketmail. > Hurry before someone else does! > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD --------------------------------- Get your preferred Email name! Now you can @ymail.com and @rocketmail.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Eins Bernardo escribió:
> Hi Art, > > Your syntax does not generate the permutations. I was wrong with the term I was using. It was supposed to be combination, not permutation. Anyway, just ignore the dice problem. > > Basically, I asked the combinations (not permutations) using "dice" as example because I want to apply it to my problem. The problem goes like this: Our school would like to offer a new training program with 8 attributes, each attribute with two levels. The following shows some of the attributes as well as the levels. > > ATTRIBUTE LEVEL > > Instruction type online, classroom > schedule weekdays, weekends > tuition below 1500, above 1500 > Attribute 4 X, Y > Attribute 5 W, Z > Attribute 6 P, Q > Attribute 7 M, N > Attribute 8 R, S > > The main goal is to list all the possible combinations in a 9 column SPSS format. For example: > > Combination InstructionType Schedule Tuition Attribute4 ... > 1 online weekdays <1500 X > 2 online weekends >1500 Y > 3 classroom weekdays <1500 X > 4 classroom weekends >1500 Y > > This can be done in SPSS using the ORTHOGONAL DESIGN procedure. However, it generates only up to 99 combinations. It cannot generate all the possible combinations needed for my problem. > > MATRIX. * Create all subset patterns for N variables(algorithm by M G-Granero) *. COMPUTE n=8. COMPUTE subset={1;2}. COMPUTE nsub=NROW(subset). LOOP i=2 TO n. /* Expanding array to N variables by recursive duplication *. . COMPUTE subset={MAKE(nsub,1,2),subset;MAKE(nsub,1,1),subset}. . COMPUTE nsub=NROW(subset). END LOOP. SAVE subset /OUTFILE=*. END MATRIX. COMPUTE combination=$casenum. FORMAT combination(F4). RENAME VARIABLES (COL1 TO COL8=InstructionType Schedule Tuition Attribute4 Attribute5 Attribute6 Attribute7 Attribute8). VALUE LABEL InstructionType 1'Online' 2'Classroom' /Schedule 1'weekdays' 2'weekends'/ Tuition 1'<1500' 2'>1500' /Attribute4 1'X' 2'Y' / Attribute5 1'W' 2'Z'/ Attribute6 1'P' 2'Q' /Attribute7 1'M' 2'N' /Attribute8 1'R' 2'S'. SUMMARIZE /TABLES=combination InstructionType TO Attribute8 /FORMAT=LIST NOCASENUM TOTAL /TITLE='Resúmenes de casos' /MISSING=VARIABLE /CELLS=NONE. HTH, Marta García-Granero -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by E. Bernardo
The first post contained syntax to generate the permutations and syntax
to "throw 3 dice". The correction only applied to the dice throwing simulation. Art Eins Bernardo wrote: > Hi Art, > > Your syntax does not generate the permutations. I was wrong with > the term I was using. It was supposed to be combination, not > permutation. Anyway, just ignore the dice problem. > > Basically, I asked the combinations (not permutations) using "dice" as > example because I want to apply it to my problem. The problem goes > like this: Our school would like to offer a new training program > with 8 attributes, each attribute with two levels. The following > shows some of the attributes as well as the levels. > > ATTRIBUTE LEVEL > > Instruction type online, classroom > schedule weekdays, weekends > tuition below 1500, above 1500 > Attribute 4 X, Y > Attribute 5 W, Z > Attribute 6 P, Q > Attribute 7 M, N > Attribute 8 R, S > > The main goal is to list all the possible combinations in a 9 column > SPSS format. For example: > > Combination InstructionType Schedule Tuition > Attribute4 ... > 1 online weekdays > <1500 X > 2 online weekends > >1500 Y > 3 classroom weekdays > <1500 X > 4 classroom weekends > >1500 Y > > This can be done in SPSS using the ORTHOGONAL DESIGN procedure. > However, it generates only up to 99 combinations. It cannot generate > all the possible combinations needed for my problem. > > I would be thankful and pleased for any help that somebody can extend. > > Eins > > > > > > > > */Art Kendall <[hidden email]>/* wrote: > > CORRECTION. CORRECTION. CORRECTION. > > * this program "throws three dice" . > *note arguments to rv.uniform. > set seed = 5743269. > input program. > vector die (3,f1). > loop throw = 1 to 2000. > loop #k = 1 to 3. > compute die(#k) = rnd(rv.uniform(.5,6.5)). > end loop. > end case. > end loop. > end file. > end input program. > formats throw (f3) die1 to die3 (f1). > frequencies vars = die1 to die3. > > Art > > > Eins Bernardo wrote: > > Hi SPSS users, > > > > For the purpose of my question here, suppose we have three cubes > (each numbered 1 to 6). The cubes are then tossed. Can we use SPSS > syntax to generate all the permutations? > > > > Thank you. > > Eins > > > > > > --------------------------------- > > New Email names for you! > > Get the Email name you've always wanted on the new @ymail and > @rocketmail. > > Hurry before someone else does! > > > > ===================== > > To manage your subscription to SPSSX-L, send a message to > > [hidden email] (not to SPSSX-L), with no body text > except the > > command. To leave the list, send the command > > SIGNOFF SPSSX-L > > For a list of commands to manage subscriptions, send the command > > INFO REFCARD > > > > > > > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text > except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > > > ------------------------------------------------------------------------ > Get your preferred Email name! > <http://sg.rd.yahoo.com/ph/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/ph/> > > Now you can @ymail.com and @rocketmail.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
|
In reply to this post by Marta Garcia-Granero
Eins
Did my solution work?You didn't tell, and I was curious. Marta GG > Eins Bernardo wrote: >> Basically, I asked the combinations (not permutations) using "dice" >> as example because I want to apply it to my problem. The problem >> goes like this: Our school would like to offer a new training >> program with 8 attributes, each attribute with two levels. The >> following shows some of the attributes as well as the levels. >> >> ATTRIBUTE LEVEL >> >> Instruction type online, classroom >> schedule weekdays, weekends >> tuition below 1500, above 1500 >> Attribute 4 X, Y >> Attribute 5 W, Z >> Attribute 6 P, Q >> Attribute 7 M, N >> Attribute 8 R, S >> >> The main goal is to list all the possible combinations in a 9 >> column SPSS format. For example: >> >> Combination InstructionType Schedule >> Tuition Attribute4 ... >> 1 online weekdays >> <1500 X >> 2 online weekends >> >1500 Y >> 3 classroom weekdays >> <1500 X >> 4 classroom weekends >> >1500 Y >> >> This can be done in SPSS using the ORTHOGONAL DESIGN procedure. >> However, it generates only up to 99 combinations. It cannot generate >> all the possible combinations needed for my problem. >> >> > Does this work the way you wanted? If not, please ask again. > > MATRIX. > * Create all subset patterns for N variables(algorithm by M G-Granero) *. > COMPUTE n=8. > COMPUTE subset={1;2}. > COMPUTE nsub=NROW(subset). > LOOP i=2 TO n. /* Expanding array to N variables by recursive > duplication *. > . COMPUTE subset={MAKE(nsub,1,2),subset;MAKE(nsub,1,1),subset}. > . COMPUTE nsub=NROW(subset). > END LOOP. > SAVE subset /OUTFILE=*. > END MATRIX. > COMPUTE combination=$casenum. > FORMAT combination(F4). > RENAME VARIABLES (COL1 TO COL8=InstructionType Schedule Tuition > Attribute4 Attribute5 Attribute6 Attribute7 Attribute8). > VALUE LABEL InstructionType 1'Online' 2'Classroom' > /Schedule 1'weekdays' 2'weekends'/ Tuition 1'<1500' 2'>1500' > /Attribute4 1'X' 2'Y' / Attribute5 1'W' 2'Z'/ Attribute6 1'P' 2'Q' > /Attribute7 1'M' 2'N' /Attribute8 1'R' 2'S'. > > SUMMARIZE > /TABLES=combination InstructionType TO Attribute8 > /FORMAT=LIST NOCASENUM TOTAL > /TITLE='Resúmenes de casos' > /MISSING=VARIABLE > /CELLS=NONE. > > HTH, > Marta García-Granero > > -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hi Marta,
A million thanks for your help. Thank you so much for the efforts you have exerted in writing the syntax for me. Regards, Eins Marta García-Granero <[hidden email]> wrote: Eins Did my solution work?You didn't tell, and I was curious. Marta GG > Eins Bernardo wrote: >> Basically, I asked the combinations (not permutations) using "dice" >> as example because I want to apply it to my problem. The problem >> goes like this: Our school would like to offer a new training >> program with 8 attributes, each attribute with two levels. The >> following shows some of the attributes as well as the levels. >> >> ATTRIBUTE LEVEL >> >> Instruction type online, classroom >> schedule weekdays, weekends >> tuition below 1500, above 1500 >> Attribute 4 X, Y >> Attribute 5 W, Z >> Attribute 6 P, Q >> Attribute 7 M, N >> Attribute 8 R, S >> >> The main goal is to list all the possible combinations in a 9 >> column SPSS format. For example: >> >> Combination InstructionType Schedule >> Tuition Attribute4 ... >> 1 online weekdays >> <1500 X >> 2 online weekends >> >1500 Y >> 3 classroom weekdays >> <1500 X >> 4 classroom weekends >> >1500 Y >> >> This can be done in SPSS using the ORTHOGONAL DESIGN procedure. >> However, it generates only up to 99 combinations. It cannot generate >> all the possible combinations needed for my problem. >> >> > Does this work the way you wanted? If not, please ask again. > > MATRIX. > * Create all subset patterns for N variables(algorithm by M G-Granero) *. > COMPUTE n=8. > COMPUTE subset={1;2}. > COMPUTE nsub=NROW(subset). > LOOP i=2 TO n. /* Expanding array to N variables by recursive > duplication *. > . COMPUTE subset={MAKE(nsub,1,2),subset;MAKE(nsub,1,1),subset}. > . COMPUTE nsub=NROW(subset). > END LOOP. > SAVE subset /OUTFILE=*. > END MATRIX. > COMPUTE combination=$casenum. > FORMAT combination(F4). > RENAME VARIABLES (COL1 TO COL8=InstructionType Schedule Tuition > Attribute4 Attribute5 Attribute6 Attribute7 Attribute8). > VALUE LABEL InstructionType 1'Online' 2'Classroom' > /Schedule 1'weekdays' 2'weekends'/ Tuition 1'<1500' 2'>1500' > /Attribute4 1'X' 2'Y' / Attribute5 1'W' 2'Z'/ Attribute6 1'P' 2'Q' > /Attribute7 1'M' 2'N' /Attribute8 1'R' 2'S'. > > SUMMARIZE > /TABLES=combination InstructionType TO Attribute8 > /FORMAT=LIST NOCASENUM TOTAL > /TITLE='Resúmenes de casos' > /MISSING=VARIABLE > /CELLS=NONE. > > HTH, > Marta García-Granero > > -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD --------------------------------- Get your preferred Email name! Now you can @ymail.com and @rocketmail.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Eins Bernardo wrote:
> A million thanks for your help. Thank you so much for the efforts you > have exerted in writing the syntax for me. I'm glad to see it works. Are you going to use it only once, or might you possibly need it again in the future for a different number of variables? If you are going to use it again, it might be worth to turn it into a fully automatic macro. A closing remark (not a rebuke, but an advise): stating clearly the problem, giving an example of the desired result, like you did after several messages exchanges with Art, helps a lot to everybody: you get a correct answer, and people willing to help will not loose time trying to write code for a vaguely expressed question. In your case, you started asking for dice permutations, and Art devoted some time to that question, and it finally turned out to be a problem of all possible combinations of 8 binary objects. Since in this list we come from everywhere in the world, sometimes the desired response is delayed several days (the person who can answer you could be sleeping while you ask your question, his/her reply reaches the list while you are in turn asleep, an so on...). Besides, if you had searched the list, you would have found this message: Re: Generating all possible binary patterns for m variables http://listserv.uga.edu/cgi-bin/wa?A2=ind0607&L=spssx-l&P=R2758 Where I posted a code very close to the one I adapted for your task. This is a general checklist for any potential asker-to-be to the list: 1) Many questions you might ask have quite probably been asked before. Before asking, check both the list and Raynald Levesque site: - http://listserv.uga.edu/archives/spssx-l.html - http://www.spsstools.net 2) Some simple statistical methods (mainly related to improving non-parametric analysis like confidence intervals & multiple comparisons) not covered by SPSS can be found at the small web page I keep at Gjalt Jorn Ygram Peter's hosting. Although chances are slim, take a look at http://gjyp.nl/marta/ 3) If you finally ask the list: - State clearly the problem, give a small sample of your data and the desired result - Say which SPSS version you are using: sometimes I write solutions designed for SPSS 14/newer, only to find out that the person who wants to use them can't because he/she is using SPSS 13, 12... we then loose time trying to rewrite everything for old versions 4) If you are finally given a solution that works, send a message to close the thread, to stop people to go on working on different solutions for an already solved problem. With a constructive intention, Marta García-Granero > */Marta García-Granero <[hidden email]>/* wrote: > > Eins > > Did my solution work?You didn't tell, and I was curious. > > > > Does this work the way you wanted? If not, please ask again. > > > > MATRIX. > > * Create all subset patterns for N variables(algorithm by M > G-Granero) *. > > COMPUTE n=8. > > COMPUTE subset={1;2}. > > COMPUTE nsub=NROW(subset). > > LOOP i=2 TO n. /* Expanding array to N variables by recursive > > duplication *. > > . COMPUTE subset={MAKE(nsub,1,2),subset;MAKE(nsub,1,1),subset}. > > . COMPUTE nsub=NROW(subset). > > END LOOP. > > SAVE subset /OUTFILE=*. > > END MATRIX. > > COMPUTE combination=$casenum. > > FORMAT combination(F4). > > RENAME VARIABLES (COL1 TO COL8=InstructionType Schedule Tuition > > Attribute4 Attribute5 Attribute6 Attribute7 Attribute8). > > VALUE LABEL InstructionType 1'Online' 2'Classroom' > > /Schedule 1'weekdays' 2'weekends'/ Tuition 1'<1500' 2'>1500' > > /Attribute4 1'X' 2'Y' / Attribute5 1'W' 2'Z'/ Attribute6 1'P' 2'Q' > > /Attribute7 1'M' 2'N' /Attribute8 1'R' 2'S'. > > > > SUMMARIZE > > /TABLES=combination InstructionType TO Attribute8 > > /FORMAT=LIST NOCASENUM TOTAL > > /TITLE='Resúmenes de casos' > > /MISSING=VARIABLE > > /CELLS=NONE. > For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
