Suppose I have the following team of researchers:
data table;
input Name:$24. Team:$24 Subjects
format Name Team $24.;
datalines;
Ken 1 10
Sally 1 8
Thomas 1 4
Mike 2 12
Jamie 2 14
Bob 3 6
;
run;
We already have subjects assigned to each researcher. However we want to assign more to each researcher so they each have 20. We have about 300 additional subjects that are assigned to a team but have yet to be assigned to a researcher. Furthermore, each subject has a test score that is weighted by team as such:
data table;
input Name:$24. Team:$24 TestScore
format Name Team $24. TestScore
datalines;
Heather 1 200
Jim 1 185
Ernie 2 200
;
run;
How do I randomly assign subjects within teams while ensuring each researcher only has 20 subjects?
1. Having both datasets named table isn't going to work well.
2. I can't see the relationship you are trying to establish between the two data sets. Perhaps a mock-up of the desired output would help.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.