proc iml; **//generate the first N prime number//; start prime(n); A=2; x=3; k=1; do until(k>=n); do i=3 to x by 2 until(mod(x,i)=0); if i=x then do; A=A//x; **//A collects all the n primes//; k=k+1; **//k counts the number of primes; end; end; x=x+1; end; return(A); finish; primes_n=prime(100); print primes_n; quit;