Hi all,
Could you please advise what SAS procedure can complete all this analysis?
Timepoint
Statistic
--------------------------------------
Pre-Dose
n
Arithmetic Mean
Geometric Mean
SD
%CV
Geometric %CV
Min
Median
Max
Except for the geometric mean and geometric cv, you can get all the others with proc means.
And if you create a LN_X= log(X) = the natural log of X, then submitting both X and LN_X to proc means would generate all the non-geo stats for X, and also the a set of stats for LN_X, including its mean and std.
Just exponentiate the mean of LN_X to get geometric mean of X.
As to "geometric %cv", as to https://en.wikipedia.org/wiki/Coefficient_of_variation, you can take the std of LN_X (call it std_lnx), and generate the geometric CV:
geo_cv = sqrt{exp[std_lnx**2]-1}
PROC MEANS or SURVEYMEANS.
For geometric mean, create a log() of the variable and then use that variable with the mean.
You can look up the definition to see how this would work.
Otherwise, both procedures can calculate all the statistics you've listed.
Please post it as text in the future, it's hard to read images and there's nothing confidential in your image.
@DmytroYermak wrote:
Hi all,
Could you please advise what SAS procedure can complete all this analysis? Or it should be several ones?
Thank you!
Except for the geometric mean and geometric cv, you can get all the others with proc means.
And if you create a LN_X= log(X) = the natural log of X, then submitting both X and LN_X to proc means would generate all the non-geo stats for X, and also the a set of stats for LN_X, including its mean and std.
Just exponentiate the mean of LN_X to get geometric mean of X.
As to "geometric %cv", as to https://en.wikipedia.org/wiki/Coefficient_of_variation, you can take the std of LN_X (call it std_lnx), and generate the geometric CV:
geo_cv = sqrt{exp[std_lnx**2]-1}
Thank you!
I have coded as you recommended:
*...**;
LN_PCORRESN=log(PCORRESN);
*...**;
proc means data=pretable2 mean std cv min median max;
var PCORRESN LN_PCORRESN;
class PCSEQ TRT01AN;
run;
*...**;
data pretable4;
set pretable3;
Geom_mean=exp(LN_PCORRESN_Mean);
run;
Just one question left:
You provided the following formula of Geometric %CV:
geo_cv = sqrt{exp[std_lnx**2]-1}
On the same time in the in the programming specification I have found the following one:
CV% geo-mean = sqrt (exp (variance for log transformed data)-1)*100.
Just one question left: Is the 'variance for log transformed data' equal to 'std_lnx**2'? Or " **2 " was missed in the specification formula?
A variance is the square of the standard deviation, so both formulas are correct.
The "100" in the second formula converts from a proportion to a percentage. Personally, I prefer to compute the proportion and then use the PERCENT8.2 format to display the proportion as a percentage.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.