Generates all combinations of the values of n variables taken k at a time in a minimal change order.

Category: | Combinatorial |

Restriction: | The ALLCOMB function cannot be executed when you use the %SYSFUNC macro. |

specifies an integer variable that is assigned values from 1 to the number of combinations in a loop.

specifies an integer constant, variable, or expression between 1 and n, inclusive, that specifies the number of items in each combination.

specifies either all numeric variables, or all character variables that have the same length. The values of these variables are permuted.

Restriction | Specify no more than 33 items. If you need to find combinations of more than 33 items, use the CALL ALLCOMBI routine. |

Requirement | Initialize these variables before executing the ALLCOMB function. |

Tip | After executing ALLCOMB, the first k variables contain the values in one combination. |

Use the ALLCOMB function
in a loop where the first argument to ALLCOMB accepts each integral
value from 1 to the number of combinations, and where k is constant. The number of combinations can
be computed by using the COMB function. On the first execution, the
argument types and lengths are checked for consistency. On each subsequent
execution, the values of two variables are interchanged.

If you execute the ALLCOMB
function with the first argument out of sequence, the results are
not useful. In particular, if you initialize the variables and then
immediately execute the ALLCOMB function with a first argument of j, then you will not get the j^{th} combination (except
when j is 1). To get the j^{th} combination,
you must execute ALLCOMB j times, with the first argument taking values from 1 through j in that exact order.

Copyright © SAS Institute Inc. All rights reserved.