I need to randomly choose k integers between 1 and T without replacement.
Here's what I've come up with:
T=60;
k=15;
/* random vector for choosing integers */
r = j(T,1,0);
call randgen(r,'uniform');
/* find indices from sorting r */
call sortndx( integers, r, {1});
/* take first k integers */
draw = integers[1:k];
I need to do it many times, and I'd rather avoid looping through this, so I'm wondering if anyone has a better solution.