BookmarkSubscribeRSS Feed
mmaleta851
Fluorite | Level 6

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 REPLY 1
SASJedi
Ammonite | Level 13

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.

Check out my Jedi SAS Tricks for SAS Users

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 632 views
  • 0 likes
  • 2 in conversation