Hi everyone, I've got three variables "a","b","c", I would like to create a list of all possible combinations with these three variables which can be duplicate.The order doesn't matter. It's like factorial problem in high school. eg. 3!=27. The result should be like the following table.I'm really appreciate it if someone can help. Thanks.
| seq | Player1 | Player2 | Player3 |
| 01 | a | a | a |
| 02 | a | a | b |
| 03 | a | a | c |
| 04 | a | b | a |
| 05 | a | b | b |
| 06 | a | b | c |
| 07 | a | c | a |
| 08 | a | c | b |
| 09 | a | c | c |
| 10 | b | a | a |
| 11 | b | a | b |
| 12 | b | a | c |
| 13 | b | b | a |
| 14 | b | b | b |
| 15 | b | b | c |
| 16 | b | c | a |
| 17 | b | c | b |
| 18 | b | c | c |
| 19 | c | a | a |
| 20 | c | a | b |
| 21 | c | a | c |
| 22 | c | b | a |
| 23 | c | b | b |
| 24 | c | b | c |
| 25 | c | c | a |
| 26 | c | c | b |
| 27 | c | c | c |
data temp;
do player1='a','b','c';
do player2='a','b','c';
do player3='a','b','c';
output;
end;
end;
end;
run;
Hi.
Does this do what you are asking for?
data temp;
do player1='a','b','c';
do player2='a','b','c';
do player3='a','b','c';
output;
end;
end;
end;
run;
Hi.
Does this do what you are asking for?
Problem solved in a light speed. Thanks!
CALL ALLCOMB
It took me more than 10 minutes to figure it out. I was questioning about myself. Thank you for your reply.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.