[code:54adb]proc sql;
select *
from (select coursetype, /*coursetype是你的课程类型变量*/
case
when coursetype="课堂" then 1
when coursetype="实验" then 2
when coursetype="见习" then 3
when coursetype="实习" then 4
else .
end as testvar
from yourtable) /*replace the yourtable using data set name*/
order by testvar;[/code:54adb]
data temp;
set old;
if coursetype='课堂' then
courseID=1;
else if coursetype='实验' then
courseID=2;
else if coursetype='见习' then
courseID=3;
else if coursetyp='实习' then
courseID=4;
run;
proc sort data=temp out=NewTemp(drop=courseID);
by courseID;
run;
直接加一个变量COURSEID,根据COURSETYPE类型,生成1,2,3,4(不必要用FORMAT创建新格式了,用IF判断了),然后按照COURSEID排序.不过不清楚在SORT中能否去掉COURSEID变量.实际和上面某位大虾的CODE差不多.