0
votes

I am new user of SAS and trying proc report,

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;

The output has two column with REGION and corresponding sum of Imp value.
I wanna try define Imp / Order; but fail.

While i would like to sort the imp descendingly. How can i achieve that? Thanks

1

1 Answers

1
votes

Well you have a couple of easy options.

First is to do a proc sort before the proc report:

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

Or you can order the proc report:

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