DATA Step, Macro, Functions and more

Student to Teacher Allocation

Reply
New Contributor
Posts: 2

Student to Teacher Allocation

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

Super User
Super User
Posts: 7,955

Re: Student to Teacher Allocation

Posted in reply to SASUserABC

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.

Ask a Question
Discussion stats
  • 1 reply
  • 191 views
  • 3 likes
  • 2 in conversation