I want to randomly assign the observations to 12 groups, trying the most posibility to make sure that the same major is in the same group and distinct provinces are in the same group. How to realize this?
Each group has 6 observations except only one group has 5 observations.
Thanks a ton!
Each group has 6 observations except only one group has 5 observations.
Thanks a ton!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id province) str45 major 1 19 "social science" 2 20 "social science" 3 7 "accounting" 4 20 "social science" 5 20 "social science" 6 9 "social science" 7 6 "economics" 8 3 "accounting" 9 5 "world trade" 10 10 "finance" 11 19 "social science" 12 11 "accounting" 13 6 "world trade" 14 18 "business" 15 17 "world trade" 16 9 "social science" 17 6 "financial tech" 18 4 "finance" 19 18 "economics" 20 4 "finance" 21 5 "financial tech" 22 6 "finance" 23 1 "economics" 24 4 "finance" 25 11 "accounting" 26 9 "social science" 27 16 "social science" 28 9 "social science" 29 9 "social science" 30 1 "economics" 31 9 "social science" 32 20 "social science" 33 5 "finance" 34 13 "business" 35 18 "finance" 36 20 "social science" 37 3 "finance" 38 1 "finance" 39 21 "business" 40 14 "social science" 41 12 "financial tech" 42 9 "social science" 43 13 "economics" 44 16 "social science" 45 5 "economics" 46 2 "financial tech" 47 1 "economics" 48 14 "social science" 49 15 "financial tech" 50 18 "economics" 51 9 "social science" 52 14 "social science" 53 14 "social science" 54 15 "financial tech" 55 6 "finance" 56 9 "social science" 57 5 "economics" 58 20 "social science" 59 10 "world trade" 60 14 "social science" 61 8 "financial tech" 62 13 "financial tech" 63 14 "social science" 64 19 "social science" 65 4 "financial tech" 66 2 "economics" 67 9 "social science" 68 9 "social science" 69 6 "business" 70 20 "social science" 71 15 "financial tech" end
Comment