In reply to Eldho Varghese.

1) Please ask programming questions at the SAS Support Communities
2) The limit for all permutation functions in SAS is k=18. That is that largest value for which fact(k) < constant("exactint"). When k=20, you can't enumerate the permuations with an integer.

On a related note, be glad that the program failed. You do NOT want to loop over (and print out!) 2.43e18 elements! You would be wise to limit your loops to less than a billion (1e9) iterations, and even loops that "small" are likely to take a long time.