PROC MEANS - Improve on the default
PROC MEANS is great for summary statistics, but is occasionally disappointing. It has some surprising conveniences. For example, did you expect to be able to create more than one output data set from just one pass?
Here is the crux of the problem. Consider this very simple invocation, driven almost entirely by defaults:
proc means data=sashelp.class noprint ; output ; run ;
The resulting data set, rendered by PROC PRINT, looks like this:
Obs _TYPE_ _FREQ_ _STAT_ Age Height Weight 1 0 19 N 19.0000 19.0000 19.000 2 0 19 MIN 11.0000 51.3000 50.500 3 0 19 MAX 16.0000 72.0000 150.000 4 0 19 MEAN 13.3158 62.3368 100.026 5 0 19 STD 1.4927 5.1271 22.774
Now, suppose you want to depart from the defaults by specifying a different set of statistics, but not change the design of the output data set. Surprisingly, the procedure provides no way to do that. The aforementioned macro does, though the grid is transposed so that each statistic is in a separate column and different (input) analysis variables are in different (output) rows.