SAS proc报告按组排序

时间:2014-09-30 07:34:48

标签: sas proc-report

我是SAS的新用户并尝试使用proc报告

filename exer2 '~/201207Hac.csv';
data work.exercise2;
    infile exer2 dlm="," firstobs=2;
    input Type $ Region $ Country $ City $ Imp Exp Ts; 
run;

proc report data = work.exercise2 nowd headline headskip;
    where type = "M";
    column Region Imp;
    define Region / group 'REGION'; 
run;

输出有两列REGION和相应的Imp值之和。 我想尝试define Imp / Order;但是失败了。

虽然我想对imp进行排序。我怎样才能实现这一目标? 感谢

1 个答案:

答案 0 :(得分:1)

嗯,你有几个简单的选择。

首先是在proc报告之前进行proc排序:

PROC SORT DATA = work.exercise2; BY DESCENDING Imp; RUN;

或者您可以订购proc报告:

proc report data = work.exercise2 nowd headline headskip;
    where type = "M";
    column Region Imp / order order=data descending;
    define Region / group 'REGION'; 
run;