You need to explicitly name the statistics in your OUTPUT statement. You can list the statistics on the PROC statement, and then refer to them in the OUTPUT statement. Like this:
proc means noprint data = sashelp.class n sum mean;
var age height;
output out=stats n=acnt hcnt
proc print data=stats;
and what you will get in the output is:
Obs Sex _TYPE_ _FREQ_ acnt hcnt asum hsum aavg havg
packaging the process, Myra and I presented (http://www2.sas.com/proceedings/sugi31/059-31.pdf) a few years ago, a solution to your problem, with a macro
The output would be something like
column name, _freq_, statistic1 .... statisticN
where the columns names to be analysed are passed into the macro as a list, or
use "varlst = _ALL_" to analyse all numeric variables
The list of statistics required, was passed as another parameter, like stts = "n min p1 p5 p10 p25 p50 mean p75 p90 p95 p99 max std "
or simplify things with "stts = _ALL_" which will report all available statistics as documented (at that time) in online help for the OUTPUT statement of PROC MEANS.
A hint of the power flexibility and simplicity of the macro might be indicated by the header of the macro:
data = &syslast ,
out = ,
print = Y,
sort = VARNUM,
stts = _ALL_,
varlst = _ALL_,
clss = ,
wghts = ,
testing= no , /* any other value will preserve the _better_: data sets */
/* default list of statistics when _all_ requested */
_stts = N MEAN STD MIN MAX CSS CV LCLM NMISS
P1 P5 P10 P25 P50 P75 P90 P95 P99 QRANGE RANGE
PROBT STDERR SUM SUMWGT KURT SKEW T UCLM USS VAR
You might notice the CLSS= parameter. This allows you to supply the list of variables to appear on a class statement. Similarly there is a parameter to define WEIGHT.
Unfortunately, the macro stored in the PDF referred above, suffered some publishing problems and a corrected version of the macro can be found in the sasCommunity.org site at http://www.sascommunity.org/wiki/PROC_MEANS_-_Improve_on_the_default
I believe you have a bug with regards to CLM statistics. The tails of the CLM statistics are determined by they way you "ask" for them. For one-tail test request just one UCLM or LCLM for two-tailed test you request both.
I believe you coded something similar to this in your macro.
output out=LCLM LCLM=;
output out=UCLM UCML=;
you get one-tailed CL.
But if you ask for both you really wanted two-tailed CL.
I use dummy variables to achieve the desired result.
* Two-tail CLM;
proc means data=sashelp.class lclm uclm;
The MEANS Procedure
Lower 95% Upper 95%
Variable CL for Mean CL for Mean
Age 12.5963445 14.0352344
Height 59.8656709 64.8080133
Weight 89.0496312 111.0030004
* Incorrect one-tailed but should be two-tailed as both are requested;
I -think- I understand what you mean when you say mean for var or sum for var -- I think you're asking what if you want mean for AGE and SUM for HEIGHT?? If so, then try the following amendment to the first code I posted. You can control the specific name that's assigned and ONLY get a statistic for 1 variable instead of for all the variables in the VAR statement by coding a slightly different construction on the OUTPUT statement...generally: stat(varname)=newvarname. So in the example below, I am getting the N for AGE, the SUM for HEIGHT, the MEAN for AGE and the MEDIAN value for both numbers with the default names for the remaining 2 variables.
Consider this code:
proc means noprint data = sashelp.class n sum mean median;
var age height;
output out=stats2 n(age)=agecnt
proc print data=stats2;
title '2) Control names selectively and only get some statistics';
title2 'N for AGE, only; SUM for HEIGHT only; MEAN for AGE, only; default names for MEDIAN';
Produces this output:
2) Control names selectively and only get some statistics
N for AGE, only; SUM for HEIGHT only; MEAN for AGE, only; default nam
Obs Sex _TYPE_ _FREQ_ agecnt htsum ageavg Age Height
Also you asked what the CLASS statement was doing...the CLASS statement is telling PROC MEANS that I want the statistics for all the rows in my DATA= file (_TYPE_ = 0) and that I want a separate row of statistics for SEX=F (_TYPE_=1) and a separate row of statistics for SEX=M (_TYPE_ = 1).
Using a CLASS statement allows me to set categories, in much the same way that the CLASS statement is used for PROC TABULATE -- it sets groups or categories -- so that the statistics can be calculated for the groups separate
from the statistics for the whole dataset. For example, you can see that the average age for the whole group of 19 observations is 13.3158, but that the 9 females have an average age of 13.2222; while the average age for the 10 males is 13.40 -- that particular feature may not be useful to you right now, but is handy to know about. (Without the CLASS statement, you would only get the _TYPE_=0 row in the output dataset.)