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;
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;
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;
Thanks. Simple and straight forward 🙂
@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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.