Are you sampling with replacement or without? Equal probability or unequal?
For equal-prob sampling without replacement, use permutations. I just did a series of blog posts on generating permutations in IML:
http://blogs.sas.com/iml/index.php?/archives/16-Generating-Random-Permutations.html
For sampling with replacement, I present a a complete module (equal or unequal probabilities) in Chapter 12 of my book
Statistial Programming with SAS/IML Stoftware. Within the next few weeks, the programs for my book should be available for download at
http://support.sas.com/publishing/authors/wicklin.html
Since the code isn't posted there yet, here's some (less general) code for the case of random sampling with replacement under uniform probability:
proc iml;
/** Module for random sampling with replacement and uniform probability.
Assume A is row vector with k elements. **/
start SampleReplaceUni(A, nSamples, nRep);
k = ncol(A); /** number of elements **/
results = j(nSamples, nRep); /** allocate result matrix **/
call randgen(results, "Uniform"); /** fill with random U(0,1) **/
results = ceil(k*results); /** convert to integers 1,2,...k **/
return (shape(A[results], nSamples)); /** reshape and return from A **/
finish;
call randseed(1234);
/** Draw 5 samples from {1,2,...,8}. Do it 10 times. **/
s = SampleReplaceUni(1:8, 10, 5);
print s;