Help using Base SAS procedures

Geometric mean in log base 10

Reply
Occasional Contributor
Posts: 5

Geometric mean in log base 10

I need to calculate the geometric mean of data.

These data are first transformed in log10.

Then I do the arithmetic mean of these log10 values and then i do the exponential of the arithmetic mean.

 

Do you confirm I am right?
 

(I find very different values from arithmetic mean so I am not sure I do the calculation correclty).

Moreover, someome told me that I should do GM = exponential of the arithmetic mean * log(10) (log function is the natural logarithm in SAS) and not just GM = exponential of the arithmetic mean
 

Thanks.for your help

Respected Advisor
Posts: 2,655

Re: Geometric mean in log base 10

The backtransformation is not exp(), but rather 10**(), when the transformation is log10.  The expression log(10)*exp() will give the same value.

Steve Denham

Occasional Contributor
Posts: 5

Re: Geometric mean in log base 10

Posted in reply to SteveDenham

Dear Steve,

Thanks for your reply.

Just to clarify, if I do 10**(mean_of_log_values), it is not equal to log(10)*exp(mean_of_log_values).

I found the same result if I do exp(mean_of_log_values * log(10).

So, what is the good formula?


Thanks.

Respected Advisor
Posts: 2,655

Re: Geometric mean in log base 10

My mistake.

Let X = mean of log10 values.

Then geometric mean = 10**X

OR geometric mean = exp(log(10)*X), where log is the natural log of 10 = 2.303 (approximately).

If the variables in question are x1 to xN, then Ksharps recommendation of geomean(x1, x2,..., xN) is the way to go.  Note that this is invalid for any x less than zero, and returns zero if any of the x's are equal to zero.  This may require transposing the data if the x values are on separate records.

Steve Denham

Super User
Posts: 10,044

Re: Geometric mean in log base 10

SAS has a function GEOMEAN() to do this way . Do you need it ?

Ask a Question
Discussion stats
  • 4 replies
  • 1568 views
  • 3 likes
  • 3 in conversation