- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I want to generate 10400 random numbers starting at 60000. How can I do that in sas?
Thank you in advance!
Adi
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Easily.
But you will need to provide more information.
What does "starting at 60000" mean? That all numbers must be 60,000 or greater? Is 60,000 exactly OK? Does the first number have to be 60,000?
Do all the numbers have to be integers?
Is there a limit to the maximum size of a random number?
Can the same number appear more than once in the series?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Go it.
Thank you all!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza,
Yes, I figured it out as below:
proc plan seed= 12345;
factors BLOCK_NUMBER=16 ordered Block=4 ordered/noprint;
treatments trt =4 random;
output out=step1 trt nvals=(1 1 2 2) ;
run;
quit;
** Kit List Number;
proc sort data=step1; by Block; run;
data step2(keep=BLOCK_NUMBER Kit_List_Number trt);
set step1;
by Block;
Kit_List_Number = _n_+ 10000;
run;
proc sort; by BLOCK_NUMBER; run;
Thanks,
Adi
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
With a do loop and the RAND() function.
@chinna0369 wrote:
Hi all,
I want to generate 10400 random numbers starting at 60000. How can I do that in sas?
Thank you in advance!
Adi
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For a general overivew, see "How to generate random numbers in SAS."
If you want only integers in a certain (such as [60000, 100000]) then see "How to generate random integers in SAS."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I like PROC PLAN as much as the next guy, but are you sure this is the answer to your question? These are not random numbers, they do not start at 60,000 and there are not 10,400 of them. Can you explain why this is the solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza,
Yes, I made some changes to my code because I don't want to share my exact code here.
Thanks,
Adi