In the following example we apply a method to get the best transformation of a single variable, URXMHP.
The sample code is a SAS dataset where a new variable LN_URXMHP is created.
Libname NH 'C:\NHANES\DATA';
Data xmehp;
set NH.Phthalate_analysis_data;
if URXMHP>. then LN_URXMHP=log(URXMHP);
run;
After the transformation, you may check the distribution of the transformed variable again, Ln(URXMHP). When comparing the descriptive estimates and plots between URXMHP and Ln_URXMHP, you see the approximation to a normal distribution is greatly improved after the transformation: the previous skewness and kurtosis are 13.176 and 233.304, now they reach at 0.581 and 0.027.
libname NH "C:\NHANES\DATA";
Data xmehp;
set NH.Phthalate_analysis_data;
if URXMHP>. then LN_URXMHP=log(URXMHP);
run;
Proc univariate data=xmehp;
var LN_URXMHP;
freq WTSPH6YR;
title "Check data distribution for Ln_URXMHP";
run;
Output of Program to Check the Transformed Variable [PDF - 124 KB]
Close Window to return to module page.