Hi @DarrylLawrence,
Here's a method similar to @Tom's suggestion, but creating numbers that look much more random than 1, 2, 3, 4, ..., namely 486956, 853476, 775530, 758721, ...:
Use the recursive formula
n=mod(386957*(n-99999),900001)+99999;
with the initial value n=100000 in the very first application and with the most recently created n in subsequent applications (if you need to add more of these pseudo-random numbers to an existing list after an interruption).
You can't get around saving and using the most recently created number (or an equivalent information) if you need to interrupt and later continue the number generating process. This is because without any information about the numbers created in the past you are always at risk of repeating one of those numbers. And the risk of getting duplicates would be extremely high, as you have seen with the RAND function: In your case the probability of getting no duplicates is approx. 2.6E-55 (if the RAND function works as it should).
With the formula above, however, you are guaranteed to get no duplicates until the 900,001st number (which is necessarily one of the 900,000 previous numbers). All created numbers are between 100,000 and 999,999, as desired.
Look at the result of this DATA step:
data want;
n=100000;
do i=1 to 15000; /* upper limit must be <=900000 to avoid duplicates */
n=mod(386957*(n-99999),900001)+99999;
output;
end;
run;
Maybe graphically:
proc sgplot data=want(obs=1000);
scatter x=i y=n;
run;
... View more