# Bioequivalence and Bioavailability Forum

Back to the forum  Query: 2017-04-29 01:47 CEST (UTC+2h)

arl_stat
Junior

India,
2017-02-13 06:58

Posting: # 17052
Views: 1,276

## SAS: Calculation of Geometric Mean [Software]

Hello Everybody,

Greetings !!!

My question is how to calculate geometric mean for untransformed data and individual concentration data using PROC GLM in SAS software for 2 way crossover study?

Helmut
Hero

Vienna, Austria,
2017-02-13 11:02

@ arl_stat
Posting: # 17054
Views: 1,152

## geomean()

Hi arl_stat

» My question is how to calculate geometric mean for untransformed data and individual concentration data using PROC GLM in SAS software for 2 way crossover study?
PROC GLM? : `geomean()` does the job.

All the best,
Helmut Schütz

The quality of responses received is directly proportional to the quality of the question asked. ☼
Science Quotes
DavidManteigas
Regular

Portugal,
2017-02-13 16:17

@ Helmut
Posting: # 17055
Views: 1,126

## geomean()

Hi Helmut,

geomean() won't solve the problem. A function could only be used within a data step or proc sql.

What the user is asking it is impossible (I think) to do within proc glm. The only way of obtaining geometric "LSmean" in proc glm is by using log-transformed data in the model statement as dependent variable.

It he/she intends to obtain geometric means from raw data, it could use either geomean within a proc sql query, use geomen within proc survey or by using proc summary in log-transformed data and the exponentiate the result in a data step.

Regards,
David
Helmut
Hero

Vienna, Austria,
2017-02-14 14:06

@ DavidManteigas
Posting: # 17056
Views: 1,014

## geomean()

Hi David,

THX for enlightening me! Since I’m not equipped with I didn’t expect that it is sooo complicated.

All the best,
Helmut Schütz

The quality of responses received is directly proportional to the quality of the question asked. ☼
Science Quotes
d_labes
Hero

Berlin, Germany,
2017-02-14 15:39

@ Helmut
Posting: # 17057
Views: 1,013

## geomean() in SAS - crap

Dear Helmut, dear David,

» THX for enlightening me! Since I’m not equipped with I didn’t expect that it is sooo complicated.

It is much more complicated as sooo, add some more ooooo .
You can use `geomean()` in SQL queries as David wrote,
```proc SQL;   select geomean(column) from data; quit;```
but it doesn't do anything, or at least not what one would expect, but gives me the column back, unchanged, and produces a warning:
```WARNING: The GEOMEAN function has been called with only one argument. However, it is not an SQL          aggregate function, and this call will not cause SQL aggregation.```
What? Why to hell?

I don't understand why the SAS people have created such a crippled implementation of the geometric mean, only useful in a data step to calculate the geometric mean over more then one variable, row-wise. And nothing else.
Forget it ! You have to roll your own.

Regards,

Detlew
DavidManteigas
Regular

Portugal,
2017-02-15 10:50

@ d_labes
Posting: # 17060
Views: 954

## geomean() in SAS - crap

Dear d_labes,

You're absolutely right. Crappy implementation of SQL in SAS as usual, the function does not work even with a "group by" statement as ordinary arithmetic functions work. SAS "reads" data line by line and apply functions to each line. Therefore, this function seems even more useless than I actually thought.

Well, from my side I always use proc summary in log-transformed data to calculate geometric means and exponentiate the result. It's amazing how such a routinely used statistic is not avaliable as part of the "default" summary functions in SAS.
ElMaestro
Hero

Denmark,
2017-02-15 11:21

@ DavidManteigas
Posting: # 17061
Views: 948

## geomean() in SAS - crap

Hi David and Detlefff and other grumpy SAS users,

you get what you pay for.
Big money, big trouble.

» You're absolutely right. Crappy implementation of SQL in SAS as usual, the function does not work even with a "group by" statement as ordinary arithmetic functions work. SAS "reads" data line by line and apply functions to each line. Therefore, this function seems even more useless than I actually thought.

Transpose the column, then `geomean` by SQL directly on the transpose, perhaps?

A

I could be wrong, but…

Best regards,
ElMaestro

Here's the good news, folks: If you leave operational excellence, (c)LEAN, six sigma and management consultancy firms out of your development programmes, then you may have a chance to be first to market and to beat your competitors.
DavidManteigas
Regular

Portugal,
2017-02-15 13:06

@ ElMaestro
Posting: # 17062
Views: 938

## geomean() in SAS - crap

Hi can't imagine how efficient that would be if you have 5000 observations that you wish to transpose into 5000 new variables
Helmut
Hero

Vienna, Austria,
2017-02-15 14:26

@ DavidManteigas
Posting: # 17064
Views: 923

## Efficiency – who cares?

Hi David,

» […] how efficient that would be […]

Who needs efficient software?
A friend of mine (in big pharma) had R-code for a large simulation study which completed overnight. The (US-based) company insisted in SAS (because SAS is “validated”…). SAS is poor in handling large datasets in RAM and starts to swap to the HD. Run-time was a couple of months. He had to buy another machine just to run the sim’s. Company was happy with that. Results were practically identical to what he already knew from R months earlier.

Fast cars, fast women, fast algorithms …
what more could a man want?
Joe Mattis

All the best,
Helmut Schütz

The quality of responses received is directly proportional to the quality of the question asked. ☼
Science Quotes
nobody
Senior

2017-02-15 15:22

@ Helmut
Posting: # 17065
Views: 907

## Efficiency – who cares?

...better safe than sorry...

SCNR

Kindest regards, nobody
DavidManteigas
Regular

Portugal,
2017-02-15 16:12

@ Helmut
Posting: # 17066
Views: 886

## Efficiency – who cares?

Hi Helmut,

The problem with "validated software" is in people who does not know anything about "software validation" but always heard that SAS is the Industry standard.

I had issues like that sometimes. Clients asking for SAS instead of R since R is not "validated" (although base R is actually validated for use in clinical trials), even for observational studies. They usually understand the point when we send them a new quotation with the extra-fee for software license
Helmut
Hero

Vienna, Austria,
2017-02-15 16:39

@ DavidManteigas
Posting: # 17067
Views: 886

## Efficiency – who cares?

Hi David,

» […] SAS is the Industry standard.

Yep – which doesn’t mean a thing. When it comes to spreadsheets, the Industry standard M\$ Excel (preferred by the guy in the Armani suit) shows a lousy performance when it comes to statistics but Open Office and Gnumeric are excellent.

» They usually understand the point when we send them a new quotation with the extra-fee for software license

That’s a splendid idea!

All the best,
Helmut Schütz

The quality of responses received is directly proportional to the quality of the question asked. ☼
Science Quotes
d_labes
Hero

Berlin, Germany,
2017-02-15 13:19

@ ElMaestro
Posting: # 17063
Views: 929

## Big money

Hi ElMaestro,

» you get what you pay for.
» Big money, big trouble.

Absolutely correct .

Regards,

Detlew
Bioequivalence and Bioavailability Forum | Admin contact
16,784 Posts in 3,605 Threads, 1,033 registered users;
16 users online (0 registered, 16 guests).

We absolutely must leave room for doubt
or there is no progress and no learning.
There is no learning without having to pose a question.
And a question requires doubt.
People search for certainty.
But there is no certainty.    Richard Feynman

The BIOEQUIVALENCE / BIOAVAILABILITY FORUM is hosted by
Ing. Helmut Schütz