DATA Step, Macro, Functions and more

Proc PLAN: Randomly Assign 7 people to three groups evenly

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 78
Accepted Solution

Proc PLAN: Randomly Assign 7 people to three groups evenly

Hello,

 

I have 6 people who can review 400 documents. I wish to have 3 reviewers assigned to each document. I would like, roughly, an even number of documents read by each reviewer.

 

I believe proc plan can help with the scenario, but I am having difficulty coming up with the code for it. 

 

Best,

 


Accepted Solutions
Solution
‎08-16-2017 04:58 PM
Super User
Posts: 22,873

Re: Proc PLAN: Randomly Assign 7 people to three groups evenly

Posted in reply to daszlosek

Not sure about PROC PLAN but a data step is easy enough:

 

*Plan data;
data plan;
seed=2017;
array rvw(3) reviewer1-reviewer3;
array person(6) (1 2 3 4 5 6);
do papers=1 to 400;
call rancomb(seed, 3, of person(*));
do i=1 to 3;
rvw(i) = person(i);



end;
output;
end;

keep papers review:;
run;

*check distribution;
proc transpose data=plan out=long prefix=reviewer;
by papers;
run;

proc freq data=long;
table reviewer:;
run;



View solution in original post


All Replies
Solution
‎08-16-2017 04:58 PM
Super User
Posts: 22,873

Re: Proc PLAN: Randomly Assign 7 people to three groups evenly

Posted in reply to daszlosek

Not sure about PROC PLAN but a data step is easy enough:

 

*Plan data;
data plan;
seed=2017;
array rvw(3) reviewer1-reviewer3;
array person(6) (1 2 3 4 5 6);
do papers=1 to 400;
call rancomb(seed, 3, of person(*));
do i=1 to 3;
rvw(i) = person(i);



end;
output;
end;

keep papers review:;
run;

*check distribution;
proc transpose data=plan out=long prefix=reviewer;
by papers;
run;

proc freq data=long;
table reviewer:;
run;



Frequent Contributor
Posts: 78

Re: Proc PLAN: Randomly Assign 7 people to three groups evenly

Reeza, thank you! I was definitely over-complicating this. I guess I just got a little too excited to have a reason to use proc plan!
SAS Super FREQ
Posts: 496

Re: Proc PLAN: Randomly Assign 7 people to three groups evenly

How about this?  

 

%mktbibd(b=400, k=3, v=6)

 

 

It makes a balanced incomplete block design.  It has 400 rows (documents), 3 columns (reviewers per document), and 6 reviewers (entries in the design).  (Which do I believe, the body of your message that says 6 or the header which says 7?)  You need SAS/IML and SAS/QC to run this.


                             Obs    x1    x2    x3

                               1     1     3     6
                               2     4     1     6
                               3     4     6     2
                               4     2     1     4
                               5     3     1     2
                               6     2     6     5
                               7     4     6     5
                               8     5     4     6
                               9     4     1     5
                              10     1     3     4
                              11     2     5     6
                              12     1     5     4
                              13     5     3     4
                              14     4     2     6
                              15     1     5     4
                              16     3     4     6
                              17     1     5     2
                              18     1     5     4
                              19     1     5     4
                              20     2     3     1
                              21     4     6     3
                              22     5     2     4
                              23     1     6     5
                              24     2     6     1
                              25     3     1     5
                              26     5     4     6
                              27     1     4     3
                              28     5     2     1
                              29     1     5     6
                              30     6     3     4
                              31     1     2     3
                              32     6     2     5
                              33     2     1     3
                              34     1     5     3
                              35     1     5     3
                              36     2     5     3
                              37     6     2     4
                              38     5     2     1
                              39     5     6     4
                              40     2     5     4
                              41     5     4     2
                              42     2     3     6
                              43     5     6     1
                              44     3     4     6
                              45     6     1     4
                              46     1     4     3
                              47     2     5     4
                              48     1     2     4
                              49     6     5     3
                              50     3     2     1
                              51     5     4     1
                              52     2     5     6
                              53     1     6     4
                              54     5     6     3
                              55     6     2     4
                              56     2     4     5
                              57     5     6     1
                              58     2     4     3
                              59     5     6     1
                              60     1     6     3
                              61     6     5     4
                              62     5     3     6
                              63     2     4     3
                              64     5     3     4
                              65     3     2     6
                              66     2     3     5
                              67     6     2     1
                              68     6     2     1
                              69     3     2     4
                              70     2     5     1
                              71     5     4     2
                              72     1     2     5
                              73     4     5     2
                              74     1     4     2
                              75     6     4     5
                              76     6     2     5
                              77     5     4     2
                              78     6     4     2
                              79     4     6     5
                              80     1     2     5
                              81     2     1     5
                              82     5     3     1
                              83     3     5     2
                              84     4     5     3
                              85     3     4     6
                              86     5     1     2
                              87     1     4     2
                              88     3     6     1
                              89     6     3     1
                              90     5     2     4
                              91     4     6     3
                              92     2     4     3
                              93     2     1     3
                              94     4     6     2
                              95     5     4     6
                              96     3     6     5
                              97     1     4     5
                              98     2     6     5
                              99     2     4     1
                             100     3     5     1
                             101     3     4     6
                             102     3     5     2
                             103     5     4     2
                             104     6     3     2
                             105     4     6     3
                             106     4     5     2
                             107     4     1     2
                             108     1     5     6
                             109     6     1     3
                             110     3     2     4
                             111     6     4     2
                             112     2     5     3
                             113     3     4     2
                             114     5     4     1
                             115     1     5     3
                             116     1     5     3
                             117     3     2     5
                             118     3     4     2
                             119     3     6     5
                             120     3     6     4
                             121     6     1     2
                             122     1     2     4
                             123     3     6     4
                             124     1     3     4
                             125     4     3     6
                             126     6     2     5
                             127     2     4     3
                             128     3     4     5
                             129     6     1     4
                             130     1     6     4
                             131     3     5     6
                             132     6     5     2
                             133     1     2     5
                             134     3     1     5
                             135     1     2     5
                             136     6     5     1
                             137     2     1     5
                             138     5     6     2
                             139     1     5     3
                             140     4     1     6
                             141     6     2     1
                             142     1     5     4
                             143     2     3     1
                             144     5     6     2
                             145     3     2     6
                             146     3     6     5
                             147     5     4     2
                             148     1     3     2
                             149     2     1     5
                             150     3     1     4
                             151     3     6     1
                             152     4     2     1
                             153     4     2     1
                             154     6     1     2
                             155     1     3     5
                             156     2     3     5
                             157     4     5     3
                             158     5     3     2
                             159     1     6     4
                             160     2     3     1
                             161     5     1     3
                             162     3     2     1
                             163     5     1     6
                             164     5     6     3
                             165     4     3     5
                             166     2     6     1
                             167     4     5     2
                             168     6     5     1
                             169     1     6     5
                             170     6     2     1
                             171     2     5     6
                             172     4     5     6
                             173     2     4     3
                             174     2     5     6
                             175     1     4     3
                             176     6     2     3
                             177     2     5     3
                             178     3     1     6
                             179     1     4     2
                             180     3     4     5
                             181     3     6     2
                             182     1     3     6
                             183     2     6     3
                             184     5     1     6
                             185     6     1     4
                             186     5     3     6
                             187     2     3     5
                             188     3     6     2
                             189     4     3     1
                             190     6     2     3
                             191     3     5     2
                             192     2     4     3
                             193     3     2     5
                             194     1     3     2
                             195     3     2     1
                             196     6     4     3
                             197     1     4     2
                             198     2     5     4
                             199     4     3     1
                             200     3     2     4
                             201     1     3     5
                             202     6     1     4
                             203     5     4     6
                             204     1     5     4
                             205     3     5     4
                             206     3     2     4
                             207     6     1     5
                             208     6     3     5
                             209     5     6     3
                             210     1     5     4
                             211     5     1     4
                             212     6     5     3
                             213     4     2     1
                             214     5     6     3
                             215     2     3     4
                             216     6     5     4
                             217     5     6     1
                             218     4     5     6
                             219     6     5     3
                             220     2     5     6
                             221     5     6     3
                             222     1     5     3
                             223     3     6     2
                             224     3     6     2
                             225     3     6     5
                             226     3     6     1
                             227     6     4     2
                             228     5     4     6
                             229     4     2     6
                             230     6     2     1
                             231     1     3     2
                             232     5     6     3
                             233     4     6     1
                             234     1     4     6
                             235     4     1     6
                             236     4     3     5
                             237     5     1     2
                             238     2     3     6
                             239     5     2     6
                             240     1     5     4
                             241     4     2     6
                             242     5     4     3
                             243     3     4     6
                             244     4     2     6
                             245     2     6     5
                             246     6     1     2
                             247     2     6     1
                             248     1     3     6
                             249     3     4     1
                             250     5     3     4
                             251     2     1     6
                             252     2     5     3
                             253     3     5     1
                             254     1     6     4
                             255     6     4     1
                             256     4     1     3
                             257     6     5     4
                             258     5     1     4
                             259     1     6     5
                             260     5     3     6
                             261     4     2     5
                             262     1     4     2
                             263     4     3     5
                             264     6     4     2
                             265     5     1     2
                             266     4     1     5
                             267     3     5     6
                             268     6     4     1
                             269     4     3     6
                             270     5     3     1
                             271     4     2     6
                             272     3     2     1
                             273     6     1     4
                             274     6     2     1
                             275     5     6     2
                             276     6     4     5
                             277     4     2     3
                             278     6     2     4
                             279     6     5     1
                             280     6     1     3
                             281     2     3     5
                             282     5     1     2
                             283     2     3     4
                             284     4     1     6
                             285     2     3     4
                             286     4     3     5
                             287     4     1     2
                             288     4     2     1
                             289     1     5     2
                             290     6     5     1
                             291     3     1     6
                             292     4     1     6
                             293     2     4     1
                             294     6     2     5
                             295     2     3     1
                             296     2     4     1
                             297     1     3     5
                             298     4     2     5
                             299     1     3     6
                             300     5     2     4
                             301     5     4     2
                             302     4     6     3
                             303     4     6     1
                             304     4     3     6
                             305     2     1     6
                             306     3     4     5
                             307     3     2     5
                             308     3     6     2
                             309     4     1     3
                             310     4     1     5
                             311     4     3     5
                             312     2     1     5
                             313     6     3     1
                             314     6     1     2
                             315     5     3     6
                             316     4     2     6
                             317     4     6     5
                             318     3     1     4
                             319     2     3     1
                             320     5     4     6
                             321     4     2     3
                             322     6     3     2
                             323     4     3     5
                             324     3     6     2
                             325     5     1     2
                             326     6     4     2
                             327     4     3     1
                             328     3     1     6
                             329     1     4     3
                             330     3     6     1
                             331     4     2     1
                             332     6     4     5
                             333     1     6     2
                             334     1     3     4
                             335     1     5     6
                             336     5     4     3
                             337     3     5     4
                             338     1     2     3
                             339     6     1     4
                             340     6     3     4
                             341     6     4     3
                             342     6     5     3
                             343     2     6     4
                             344     4     5     2
                             345     4     2     6
                             346     3     5     4
                             347     2     4     1
                             348     5     1     3
                             349     6     2     4
                             350     1     3     5
                             351     4     1     5
                             352     3     4     1
                             353     3     5     2
                             354     5     1     2
                             355     6     1     3
                             356     5     2     3
                             357     2     3     4
                             358     4     5     3
                             359     4     3     1
                             360     1     3     2
                             361     2     4     3
                             362     1     3     5
                             363     5     1     4
                             364     6     4     1
                             365     2     3     6
                             366     6     3     1
                             367     3     2     4
                             368     3     1     4
                             369     5     4     6
                             370     2     5     6
                             371     5     1     4
                             372     2     6     3
                             373     2     3     1
                             374     3     2     5
                             375     5     2     6
                             376     4     6     3
                             377     6     2     1
                             378     6     3     2
                             379     6     1     5
                             380     3     6     1
                             381     2     1     6
                             382     5     1     3
                             383     4     6     2
                             384     4     6     1
                             385     4     1     5
                             386     3     1     4
                             387     2     4     5
                             388     6     3     1
                             389     1     2     3
                             390     3     6     2
                             391     5     2     6
                             392     2     4     3
                             393     2     3     6
                             394     2     1     3
                             395     5     6     2
                             396     4     5     3
                             397     1     2     5
                             398     1     6     2
                             399     1     5     2
                             400     5     1     6

to run this.

 

 

%mktbibd(b=400, k=3, v=6)

Super User
Posts: 10,621

Re: Proc PLAN: Randomly Assign 7 people to three groups evenly

Posted in reply to daszlosek

Wouldn't be simpler for proc surveyselect ?

 

data plan;
do person=1 to 6;
output;
end;
run;

proc surveyselect data=plan method=srs sampsize=3 reps=400 out=want;
run;

proc freq data=want;
table person;
run;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 198 views
  • 2 likes
  • 4 in conversation