Hi:
Let's say you have some data, you want to work with that data and you know that the data is currently ordered by REGION, but you need the data ordered by YEAR. So, ou would use PROC SORT to do the reordering:
[pre]
proc sort data=perm.salesdata;
by year region;
run;
[/pre]
would sort the data "in place" -- that means that by the time the sort was done, perm.salesdata would have been reorganized and would now be in order by year and then region within year.
But, if you had this:
[pre]
proc sort data=perm.salesdata out=work.sales_year;
by year region;
run;
[/pre]
then...the "original" file perm.salesdata would still be in the "original" order but the new (and temporary) file work.sales_year would be the same data, only ordered by year and then region within year.
In the above 2 instances, the BY statement is telling PROC SORT how to order the variables...so right now, I have BY YEAR REGION; which would order by YEAR first, then by REGION within YEAR.
If I had BY REGION YEAR; then I would get ordering by REGION first and then by YEAR within each region.
For more information PROC SORT, such as eliminating duplicates or sorting in descending order, I recommend the SORT documentation or you might consider contacting Tech Support for more help.
cynthia