# re: st: pseudo random orders for treatment levels

 From David Airey To statalist@hsphsun2.harvard.edu Subject re: st: pseudo random orders for treatment levels Date Mon, 11 Aug 2003 12:44:29 -0500

Here is example data that I want randomized/reordered by within period. What simple trick am I missing?

. set obs 40
obs was 0, now 40
. gen index = _n
. egen period = seq(), from(1) to(4) block(10)
. egen order = seq(), from(1) to(5) block(2)

+------------------------+
| index period order |
|------------------------|
1. | 1 1 1 |
2. | 2 1 1 |
3. | 3 1 2 |
4. | 4 1 2 |
5. | 5 1 3 |
|------------------------|
6. | 6 1 3 |
7. | 7 1 4 |
8. | 8 1 4 |
9. | 9 1 5 |
10. | 10 1 5 |
|------------------------|
11. | 11 2 1 |
12. | 12 2 1 |
13. | 13 2 2 |
14. | 14 2 2 |
15. | 15 2 3 |
|------------------------|
16. | 16 2 3 |
17. | 17 2 4 |
18. | 18 2 4 |
19. | 19 2 5 |
20. | 20 2 5 |
|------------------------|
21. | 21 3 1 |
22. | 22 3 1 |
23. | 23 3 2 |
24. | 24 3 2 |
25. | 25 3 3 |
|------------------------|
26. | 26 3 3 |
27. | 27 3 4 |
28. | 28 3 4 |
29. | 29 3 5 |
30. | 30 3 5 |
|------------------------|
31. | 31 4 1 |
32. | 32 4 1 |
33. | 33 4 2 |
34. | 34 4 2 |
35. | 35 4 3 |
|------------------------|
36. | 36 4 3 |
37. | 37 4 4 |
38. | 38 4 4 |
39. | 39 4 5 |
40. | 40 4 5 |
+------------------------+

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/