You're right - proc means will not do this. Why not???

Anyway, I think will the following SAS code will.

Note - comment out all lines using PRODUCT if you have a lot of variables >1, otherwise the numbers get too big!

/* dataset to try code on */

data tst;

length VAR 8.;

do VAR=1 to 10;

output;

end;

run;

/* datastep to calculate all sorts of means */

data tst_m (keep=ARITHMETIC_MEAN GEOMETRIC_MEAN_A GEOMETRIC_MEAN_B HARMONIC_MEAN);

set tst end=EOF;

retain COUNT PRODUCT SUM SUM_LOGS SUM_INV;

length COUNT PRODUCT SUM SUM_LOGS SUM_INV ARITHMETIC_MEAN GEOMETRIC_MEAN_A GEOMETRIC_MEAN_B HARMONIC_MEAN 8.;

LOG_VAR = log(VAR);

/* initialise to 0 */

if _N_=1 then do;

COUNT= 0 ;

PRODUCT=1;

SUM_LOGS = 0;

SUM =0 ;

SUM_INV = 0;

end;

/* note - product gets too big in most cases, so sum logs instead */

COUNT=COUNT+1;

PRODUCT=PRODUCT*VAR;

SUM_LOGS=SUM_LOGS+LOG_VAR;

SUM=SUM+VAR;

SUM_INV=SUM_INV+1/VAR;

if EOF then do;

ARITHMETIC_MEAN = SUM/COUNT;

GEOMETRIC_MEAN_A = PRODUCT**(1/COUNT);

GEOMETRIC_MEAN_B = exp((1/COUNT)*SUM_LOGS);

HARMONIC_MEAN = 1/(SUM_INV/COUNT);

output;

end;

run;