You need to generate a permutation of the numbers 1:N (N=number of obs) and use the permutation as indices to form a new vector.
There are several ways to do this. The simplest is to generate random uniform numbers and then use the RANK function to assign integers that correspond to the order of the random numbers:
N = 10; /* number of observations in data */
u = j(N, 1); /* allocate Nx1 vector */
call randgen(u, "Uniform"); /* fill u with random uniform */
p = rank(u); /* p is random permutation of 1:N */
print u p;
newY = oldY
; /* new vector = permutation of data */