- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. Simple and straight forward 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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