SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Computing Frequency Distributions
Producing Frequency Tables


Example: ORDER=FORMATTED

ORDER=FORMATTED places variable values in the order of their formatted values. If the formatted values are character values, they are arranged in alphabetical order.

Hot Tip: It's often helpful to group variable values by defining a format with the FORMAT procedure. This can categorize your data in meaningful ways, as in the program below where the inch values of Height vary widely.
     proc format;
        value htfmt low-64='Short'
                    65-70='Medium'
                    71-high='Tall';
     run;
     proc freq data=clinic.diabetes
          order=formatted;
        tables height;
        format height htfmt.;
     run;

For details, see the lesson Formatting Variable Values.


Height Frequency Percent Cumulative
Frequency
Cumulative
Percent
Medium 8 40.00 8 40.00
Short 7 35.00 15 75.00
Tall 5 25.00 20 100.00



Example: ORDER=FREQ

ORDER=FREQ arranges variable values in the order of descending frequency.

     proc freq data=clinic.diabetes order=freq;
        tables height;
     run;

Height Frequency Percent Cumulative
Frequency
Cumulative
Percent
64 3 15.00 3 15.00
61 2 10.00 5 25.00
65 2 10.00 7 35.00
66 2 10.00 9 45.00
68 2 10.00 11 55.00
70 2 10.00 13 65.00
71 2 10.00 15 75.00
62 1 5.00 16 80.00
63 1 5.00 17 85.00
72 1 5.00 18 90.00
73 1 5.00 19 95.00
75 1 5.00 20 100.00



back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement