Skip Navigation
*To search for student contact information, login to FlashLine and choose "My Campus" tab.

Search by campus:

SAS Proc Sort Screenshots Tutorial

Proc sort arranges observations of the data set.

  • Can create a new SAS data set containing rearranged observations.
  • Sorts ascending (default) and descending.
  • Does not provide printed output (that requires the proc print statements).
  • Treats missing data as smallest possible value.

SAS 9.1.4 Proc Sort 1

In the above example, we have sorted the departments in alphabetical order and used proc print to print the department, satisfaction score, and year data only.

proc print data=train.sastraining;

by department;

proc print data=train.sastraining NOOBS;

var department satisfaction years;

run;

SAS 9.1.4 Proc Sort 2

In the above example, we have sorted by department and then printed by department including a column total for years.

proc sort data=train.sastraining;

by department;

proc print data=train.sastraining NOOBS;

by department

sum years;

run;

SAS 9.1.4 Proc Sort 3

Finally, in this example above, we have sorted by department and then used Pageby in proc print to put each department's data on a different page.

proc sort data=train.sastraining;

by department;

proc print data=train.sastraining NOOBS;

by department;

pageby department;

sum years;

run;

For additional questions or assistance, contact Tina Ughrin.

Research Software Tutorial Survey

1. This tutorial was helpful. This field is required

2. Suggestions for additions or changes to this tutorial.

3. How did you find out about this webpage?