Previous Page | Next Page

The SORT Procedure

Example 2: Sorting in Descending Order


Procedure features:

This example BY statement option:

DESCENDING

Other features

PROC PRINT

Data set: ACCOUNT


Program

 Note about code
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
proc sort data=account out=sorted;
 Note about code
   by town descending debt accountnumber;
run;
 Note about code
proc print data=sorted;
 Note about code
   var company town debt accountnumber;
 Note about code
   title  'Customers with Past-Due Accounts';
   title2 'Listed by Town, Amount, Account Number';
run;

Output

 Note about figure
                        Customers with Past-Due Accounts                       1
                     Listed by Town, Amount, Account Number

                                                                  Account
      Obs    Company                   Town              Debt      Number

        1    Paul's Pizza              Apex              83.00      1019 
        2    Peter's Auto Parts        Apex              65.79      7288 
        3    Watson Tabor Travel       Apex              37.95      3131 
        4    Tina's Pet Shop           Apex              37.95      5108 
        5    Apex Catering             Apex              37.95      9923 
        6    Deluxe Hardware           Garner           467.12      8941 
        7    Boyd & Sons Accounting    Garner           312.49      4762 
        8    World Wide Electronics    Garner           119.95      1122 
        9    Elway Piano and Organ     Garner            65.79      5217 
       10    Ice Cream Delight         Holly Springs    299.98      2310 
       11    Tim's Burger Stand        Holly Springs    119.95      6335 
       12    Strickland Industries     Morrisville      657.22      1675 
       13    Pauline's Antiques        Morrisville      302.05      9112 
       14    Bob's Beds                Morrisville      119.95      4998 

Previous Page | Next Page | Top of Page