假设有某班学生名单列表(小表)name_list(name id),以及全校学生信息数据表(大表)student_info(name id parent address email),现在需要根据全校学生名单列表name_list,获取班级名单中学号id对应学生的信息。
select * from student_info t1 where t1.name in (select name from name_list)
proc sort data=name_list; by id; run; proc sort data=student_info; by id; run;
data class_student_info; merge name_list(in=a) student_info(in=b); by id; if (a=1 & b=1); run;