| Computing Frequency Distributions |
| Producing Frequency
Tables |
| Specifying Frequency Order
By default, PROC FREQ displays frequency distributions in the order of each variable's unformatted values. This is known as internal order. proc freq data=clinic.diabetes;
tables height;
run;
|
| Height | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
| 61 | 2 | 10.00 | 2 | 10.00 |
| 62 | 1 | 5.00 | 3 | 15.00 |
| 63 | 1 | 5.00 | 4 | 20.00 |
| 64 | 3 | 15.00 | 7 | 35.00 |
| 65 | 2 | 10.00 | 9 | 45.00 |
| 66 | 2 | 10.00 | 11 | 55.00 |
| 68 | 2 | 10.00 | 13 | 65.00 |
| 70 | 2 | 10.00 | 15 | 75.00 |
| 71 | 2 | 10.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 |
| You might prefer to view the values in a different order. To control the way that PROC FREQ displays distributions, add the ORDER= option to the PROC FREQ statement and specify the method you prefer. |
General form, ORDER= option:
where
|
| Example: ORDER=DATA
ORDER=DATA arranges variable values in the order they first occur in the input data. |
SAS Data Set Clinic.Diabetes
| ID | Sex | Age | Height | Weight | Pulse | FastGluc | PostGluc |
| 2304 | F | 16 | 61 | 102 | 100 | 568 | 625 |
| 1128 | M | 43 | 71 | 218 | 76 | 156 | 208 |
| 4425 | F | 48 | 66 | 162 | 80 | 244 | 322 |
| 1387 | F | 57 | 64 | 142 | 70 | 177 | 206 |
| 9012 | F | 39 | 63 | 157 | 68 | 257 | 318 |
| 6312 | M | 52 | 72 | 240 | 77 | 362 | 413 |
| 5438 | F | 42 | 62 | 168 | 83 | 247 | 304 |
| 3788 | M | 38 | 73 | 234 | 71 | 486 | 544 |
| 9125 | F | 56 | 64 | 159 | 70 | 166 | 215 |
| 3438 | M | 15 | 66 | 140 | 67 | 492 | 547 |
| 1274 | F | 50 | 65 | 153 | 70 | 193 | 271 |
| 3347 | M | 53 | 70 | 193 | 78 | 271 | 313 |
| 2486 | F | 63 | 65 | 157 | 70 | 152 | 224 |
| 1129 | F | 48 | 61 | 137 | 69 | 267 | 319 |
| 9723 | M | 52 | 75 | 219 | 65 | 348 | 403 |
| 8653 | M | 49 | 68 | 185 | 79 | 259 | 311 |
| 4451 | M | 54 | 71 | 196 | 81 | 373 | 431 |
| 3279 | M | 40 | 70 | 213 | 82 | 447 | 504 |
| 4759 | F | 60 | 68 | 164 | 71 | 155 | 215 |
| 6488 | F | 59 | 64 | 154 | 75 | 362 | 409 |
proc freq data=clinic.diabetes order=data;
tables height;
run;
|
Height |
Frequency |
Percent |
Cumulative |
Cumulative |
61 |
2 |
10.00 |
2 |
10.00 |
71 |
2 |
10.00 |
4 |
20.00 |
66 |
2 |
10.00 |
6 |
30.00 |
64 |
3 |
15.00 |
9 |
45.00 |
63 |
1 |
5.00 |
10 |
50.00 |
72 |
1 |
5.00 |
11 |
55.00 |
62 |
1 |
5.00 |
12 |
60.00 |
73 |
1 |
5.00 |
13 |
65.00 |
65 |
2 |
10.00 |
15 |
75.00 |
70 |
2 |
10.00 |
17 |
85.00 |
75 |
1 |
5.00 |
18 |
90.00 |
68 |
2 |
10.00 |
20 |
100.00 |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.