Hello!
How to transform data through the log transformation to ensure a normal distribution for the somatic cells count variable, please?
is there any test to test the normality of the data before?
Finally, is there a procedure or other way to do the log transformation?
Thank you!
To transform a variable to its logarithmic form, you just need to apply "log()" function, this function returns the natural (base e) logarithm. You can also use "log2()" (base 2) and "log10()" (base 10).
data _null_;
x=10;
y1=log(x);
y2=log2(x);
y3=log10(x);
put y1=/ y2=/ y3=;
run;
y1=2.302585093
y2=3.3219280949
y3=1
To test the normality of data, you can use "proc univariate" with a "normal" option.
proc univariate data=sashelp.class normal qqplot;
var height;
run;
The result window will show you test result like this:
You can also use qqplot statement in this procedure, to get a Q-Q plot of analysis variable.
To transform a variable to its logarithmic form, you just need to apply "log()" function, this function returns the natural (base e) logarithm. You can also use "log2()" (base 2) and "log10()" (base 10).
data _null_;
x=10;
y1=log(x);
y2=log2(x);
y3=log10(x);
put y1=/ y2=/ y3=;
run;
y1=2.302585093
y2=3.3219280949
y3=1
To test the normality of data, you can use "proc univariate" with a "normal" option.
proc univariate data=sashelp.class normal qqplot;
var height;
run;
The result window will show you test result like this:
You can also use qqplot statement in this procedure, to get a Q-Q plot of analysis variable.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.