In reply to Ankur biswas.

I regret that I cannot offer personal assistance. For up to N<=18, you can look at the ALLPERM function in the DATA step. No computer can possibly generate all permutations for even modest values of N. Factorials grow really fast: 60! = 10^80 and even the world's fastest computer can only manage 10^16 computations per second. At that rate, it would require 10^64 seconds to compute all permutations, which is much longer than the age of the universe.