BookmarkSubscribeRSS Feed
SASUserABC
Calcite | Level 5

Hoping you guys can help get me started.  I have a list of 500 students and 20 teachers and trying to allocate students to teachers based on a number of parameters such as maximum class size of 30, subject preference of student to subject specialisation of teacher, must not have had teacher in previous academic year etc. etc.

Would anyone be able to advise how I would get started on a simple allocation say on parameter of maximum class size so all classes have equal number of students.  I can then take this to optimise further by building in further parameters.

Struggling at this stage to get started with a basic approach, have tired arrays but no joy.

Many thanks

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well assigning them based on sequence is very simple:

data students;

  name="abc"; output;

  name="def"; output;

  name="egh"; output;

  name="wer"; output;

  name="lhj"; output;

run;

data teachers;

  teacher="xyz"; teach=1; output;

  teacher="iop"; teach=2; output;

run;

data temp; 

  set students;

  if _n_<=3 then teach=1;

  else teach=2;

run;

proc sql;

  create table WANT as

  select  A.TEACHER,

          B.NAME

  from    TEACHERS A

  left join TEMP B

  on      A.TEACH=B.TEACH;

quit;

Just assign them an id, each teacher has a unique id, each student is grouped based on _n_.  However I feel your other rules are going to be more complicated, i.e. if 90% of students want subject A, then how to arrive at which % of them go into one or the other.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 720 views
  • 3 likes
  • 2 in conversation