## PROC FREQ -- change the order of the output

Solved
Super Contributor
Posts: 286

# PROC FREQ -- change the order of the output

How can I change the order of the output so that grade17 appears in descending order?

SAS Output

Frequency
Cumulative
Percent
0   .   574 5.72 574 5.72
0   0   213 2.12 787 7.85
0   0 NS 1 0.01 788 7.86
1   .   44 0.44 832 8.30
1   0   731 7.29 1563 15.58
1   0 GC 3 0.03 1566 15.61
1   0 NS 1 0.01 1567 15.62
1   0 W22 10 0.10 1577 15.72
1   0 W25 1 0.01 1578 15.73
1   1   12 0.12 1590 15.85
2   .   40 0.40 1630 16.25

Accepted Solutions
Solution
‎11-18-2016 10:22 AM
Super User
Posts: 13,574

## Re: PROC FREQ -- change the order of the output

Easiest may be to send the data to an output data set and sort that.

proc freq noprint ;
run;

proc sort data=temp;

run;

proc print data=temp;

run;

All Replies
Super User
Posts: 23,759

## Re: PROC FREQ -- change the order of the output

Include the code you're using please.

Have you tried order= option?

Super Contributor
Posts: 286

## Re: PROC FREQ -- change the order of the output

proc freq;
run;

Solution
‎11-18-2016 10:22 AM
Super User
Posts: 13,574

## Re: PROC FREQ -- change the order of the output

Easiest may be to send the data to an output data set and sort that.

proc freq noprint ;
run;

proc sort data=temp;

run;

proc print data=temp;

run;

New Contributor
Posts: 3

## Re: PROC FREQ -- change the order of the output

You need to sort the data in descending order by grade17.  Then, in the proc freq, use the order=data option.

proc sort data=filename;

run;

proc freq data=filename order=data;

run;

SAS Super FREQ
Posts: 4,242