Hi all,

One of the statistical computations that I've been working on involves assigning 10,000 columns of random orders. I can't really think of any efficient way for this part of the task, so I want to seek help from you guys. Detailed info and example see below:

What I want to do is to generate 10,000 sets of random orders from 1 to 1000. It should look something like this:
order1 order2 order3 ... order10000
1 999 567 ... 1000
2 976 432 ... 999
... ... ... ... ...
1000 2 254 ... 1
One way that I can think of to achieve what I want is:
PHP Code:
clear all
set obs 1000

forvalues i 
1/10000 {
    
gen u`i' = runiform()
    sort u
`i'    
    gen order`i' 
_n

But as you can imagine, this is pretty inefficient. Is there any way you know to generate the wanted data more efficiently?

Thank,
CL