In reply to Emmanuel.

Yes, that is the definition of a binomial distribution. To simulate the coin flips, look at the SAS documentation for the RAND function and the "Bernoulli" distribution. A (more complicated) example is available in this blog post.