BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Claus_Stenberg
Fluorite | Level 6

Trying to get the geometric mean with  SE, STD and CLM on some clinical data and want the outputs stats to be saved as a SAS datafile for further processing. 

 

Was thinking of using proc surveymeans as I want the variance of the geometric mean to be estimated using the Taylor series. 

How do I get the relevant stats in the output dataset ?  

Below code only gives me the SE, STD and CLM to the arithmetic mean - NOT the geometric mean. 

 

Somebody that can help a newbie  to surveymeans ?   

 

A small example: 

proc sort data=sashelp.class out=test;
 by sex;
run;

 

proc surveymeans data=test alpha=0.05 geomean std stderr clm ;
 by sex;
 var age;
 ods output
   Statistics = stats_ds;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You can use ODS output to get any calculated statistics from any procedure into a SAS data set. Example:

 

proc surveymeans data=sashelp.class allgeo;
    ods output geometricmeans=geometricmeans;
    var height;
run;

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

You can use ODS output to get any calculated statistics from any procedure into a SAS data set. Example:

 

proc surveymeans data=sashelp.class allgeo;
    ods output geometricmeans=geometricmeans;
    var height;
run;

 

--
Paige Miller
Claus_Stenberg
Fluorite | Level 6

Thanks. Simple and straight forward 🙂

SteveDenham
Jade | Level 19

@PaigeMiller shows that you can get what you want using PROC SURVEYMEAN, but you can also get the CLM with a DATA step by exponentiating the confidence bounds of the log transformed data.  STD and SE are a different matter.  Read through Alex Kritchevsky's webpage.  It has formulas for calculating the variability estimates, and lots of cautionary items about the use of these measures.  See http://alexkritchevsky.com/2018/06/15/geometric-mean.html 

 

Alternatively, you could use PROC FMM to fit a non-mixture distribution of a lognormal distribution.  Use the OUTPUT statement to get a dataset with means and variances, and from those calculate standard deviations and standard errors.

 

In the end, though, @PaigeMiller  has the answer you requested.

 

SteveDenham

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1249 views
  • 4 likes
  • 3 in conversation