Computing Statistics for Numeric Variables |
Group
Processing |
BY Group Processing
Like the CLASS statement, the BY statement specifies variables to use for categorizing observations. |
General form, BY statement:
where BY variable(s) specifies category variables for group processing. |
But BY and CLASS differ in two key ways:
proc sort data=clinic.heart out=work.hartsort; by survive sex; run; proc means data=work.hartsort maxdec=1; var arterial heart cardiac urinary; by survive sex; run; |
Variable | N | Mean | Std Dev | Minimum | Maximum |
Arterial Heart Cardiac Urinary |
4 4 4 4 |
92.5 111.0 176.8 98.0 |
10.5 53.4 75.2 186.1 |
83.0 54.0 95.0 0.0 |
103.0 183.0 260.0 377.0 |
Variable | N | Mean | Std Dev | Minimum | Maximum |
Arterial Heart Cardiac Urinary |
6 6 6 6 |
94.2 103.7 318.3 100.3 |
27.3 16.7 102.6 155.7 |
72.0 81.0 156.0 0.0 |
145.0 130.0 424.0 405.0 |
Variable | N | Mean | Std Dev | Minimum | Maximum |
Arterial Heart Cardiac Urinary |
5 5 5 5 |
77.2 109.0 298.0 100.8 |
12.2 32.0 139.8 60.2 |
61.0 77.0 66.0 44.0 |
88.0 149.0 410.0 200.0 |
Variable | N | Mean | Std Dev | Minimum | Maximum |
Arterial Heart Cardiac Urinary |
5 5 5 5 |
78.8 100.0 330.2 111.2 |
6.8 13.4 87.0 152.4 |
72.0 84.0 256.0 12.0 |
87.0 111.0 471.0 377.0 |
Because it doesn't demand a sorting step, the CLASS statement is simpler to use than the BY statement. However, BY group processing can be more efficient when categorizing data with many variables. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.