turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Factorial variables in a do loop? Need a Help!LOL

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-28-2017 10:43 PM

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 |

Accepted Solutions

Solution

11-28-2017
11:25 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to EC189QRW

11-28-2017 11:02 PM

```
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?

All Replies

Solution

11-28-2017
11:25 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to EC189QRW

11-28-2017 11:02 PM

```
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?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ABritinAus

11-28-2017 11:25 PM

Problem solved in a light speed. Thanks!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to EC189QRW

11-28-2017 11:25 PM

CALL ALLCOMB

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to EC189QRW

11-28-2017 11:25 PM

What's LOL about the question?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

11-28-2017 11:32 PM

It took me more than 10 minutes to figure it out. I was questioning about myself. Thank you for your reply.