BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DmytroYermak
Lapis Lazuli | Level 10

Hi all,

 

Could you please advise what SAS procedure can complete all this analysis?large (1).jpg

Timepoint
  Statistic
--------------------------------------
Pre-Dose
   n
   Arithmetic Mean
   Geometric Mean
   SD
   %CV
   Geometric %CV
   Min
   Median
   Max
1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

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}

 

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

5 REPLIES 5
Reeza
Super User

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?

4.jpg

 

Thank you!


 

mkeintz
PROC Star

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}

 

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
DmytroYermak
Lapis Lazuli | Level 10
Thank you for the replies! I will publish the code here later on.
DmytroYermak
Lapis Lazuli | Level 10

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?

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 36203 views
  • 2 likes
  • 4 in conversation