While using CLASS and BY Statements in PROC MEANS one should keep in mind :
Use the CLASS Statement when number of observation >10000
Use the By Statement when number of observation <1000
Using the BY Statement requires that the input data set be sorted by the values of the classification variables
Using the CLASS Statement requires that the input data set be sorted by the values of the classification variables