BookmarkSubscribeRSS Feed
gekco
Fluorite | Level 6

I am looking at a highly skewed variable where most values are clustered around 3-12 but values range from 0-350. When I log-transform the variable it almost fits a normal distribution. I would like to perform and log conversion and back-transformation when reporting the mean. My code is:

 

proc surveymeans data=work.test geomean;

var ex;

run;

 

When I run this code after removing all 0 values I get a number that looks like what I would expect. The problem is when I try to run it on all values of the variable, I get an error message saying 'a variable must be positive when geometric mean is requested'. Can I get around that by adding 1 to all values of the variable?

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Yes, you can. See "Log transformations: How to handle zero values." Physically, you are changing the measurement definition. For example, instead of a count, you are no measuring "one more than the count."

 

I always encourage analysts to ask whether the LOG transformation is the best to use. For example, the square-root transformation is also a normalizing transformation but preserves the value of zero.

gekco
Fluorite | Level 6

I am basing these methods off of a paper that says they 'performed a log conversion and report results following back-transformation'. At first I assumed that meant geometric mean but now I do not think so. Does that just mean they completed the analyses on log-tranformed variables but reported the means un-tranformed?

 

I do not think the geometric mean is what I should be using here after all. Adding a value to the variable dramatically changes the geometric mean. So for example adding .00001 gives me a geomean of 3.55 (SE 0.05) while adding 1 gives me a geomean of 6.13 (SE 0.04). The smaller the constant, the smaller the geomean. This would make sense since the geometric mean of x, y, z = sqrt(x*y*z). But I cannot see a way to determine what constant to add. 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 766 views
  • 1 like
  • 2 in conversation