*Program 14-8 Using PROC SORT to change the order of your observations; proc sort data=learn.sales; by TotalSales; run; title "Listing of SALES"; proc print data=learn.sales; id EmpID; var Customer Quantity TotalSales; format TotalSales dollar10.2 Quantity comma7.; run; *Program 14-9 Demonstrating the DESCENDING option of PROC SORT; proc sort data=learn.sales; by descending TotalSales; run; *Program 14-10 Sorting by more than one variable; proc sort data=learn.sales out=sales; by EmpID descending TotalSales; run; title "Sorting by More than One Variable"; proc print data=sales; id EmpID; var TotalSales Quantity; format TotalSales dollar10.2 Quantity comma7.; run; *Program 14-11 Using labels as column headings with PROC PRINT; title "Using Labels as Column Headings"; proc print data=sales label; id EmpID; var TotalSales Quantity; label EmpID = "Employee ID" TotalSales = "Total Sales" Quantity = "Number Sold"; format TotalSales dollar10.2 Quantity comma7.; run; *Program 14-12 Using a BY statement in PROC PRINT ; proc sort data=learn.sales out=sales; by Region; run; title "Using Labels as Column Headings"; proc print data=sales label; by Region; id EmpID; var TotalSales Quantity; label EmpID = "Employee ID" TotalSales = "Total Sales" Quantity = "Number Sold"; format TotalSales dollar10.2 Quantity comma7.; run; *Program 14-13 Adding totals and subtotals to your listing; proc sort data=learn.sales out=sales; by Region; run; title "Adding Totals and Subtotals to Your Listing"; proc print data=sales label; by Region; id EmpID; var TotalSales Quantity; sum Quantity TotalSales; label EmpID = "Employee ID" TotalSales = "Total Sales" Quantity = "Number Sold"; format TotalSales dollar10.2 Quantity comma7.; run; *Program 14-14 Using an ID and BY statement in PROC PRINT; proc sort data=learn.sales out=sales; by EmpID; run; title "Using the Same Variable in an ID and BY Statement"; proc print data=sales label; by EmpID; id EmpID; var Customer TotalSales Quantity; label EmpID = "Employee ID" TotalSales = "Total Sales" Quantity = "Number Sold"; format TotalSales dollar10.2 Quantity comma7.; run;