Hello,
I have some data on net nitrogen mineralization and the values range from negative to positive. I measured nitrogen mineralization over several days and obtained the net nitrogen mineralization. I tried the approach below but could not obtain an output to merge to my data set. @Rick_SAS
Thanks,
proc iml;
use work.idnet2;
read all var {NetNit };
LNetNit = log10(NetNit + 1 - min(NetNit )); /* translate, then transform */
LogNetNit = j(nrow(NetNit ),1,.); /* allocate missing */
idx = loc(NetNit > 0); /* find indices where Y > 0 */
if ncol(idx) > 0 then
LogNetNit [idx] = log10(NetNit [idx]);
print NetNit LNetNit LogNetNit ;
How do I obtain my output for further analysis? How do I obtain back-transformed means and standard errors??
With the LNetNit transformation, all values were positive? Is this acceptable?
With the LogNeNit, I had a lot of missing data and negative values.
If I understand your question, you don't want to check whether NetNit is positive, you want to check whether the translated data is positive:
proc iml;
use work.idnet2;
read all var {NetNit };
LNetNit = log10(NetNit + 1 - min(NetNit )); /* translate, then transform */
LogNetNit = j(nrow(NetNit ),1,.); /* allocate missing */
Y = NetNit + 1 - min(NetNit ); /* <== use the translated data */
idx = loc(Y > 0); /* find indices where Y > 0 */
if ncol(idx) > 0 then
LogNetNit[idx] = log10(Y[idx]);
print NetNit LNetNit LogNetNit ;
Yes, NetNit contains both negative and positive values and when I take the log of NetNit in Proc Glimmix, I end up having missing values.
However, with the code below, I have the data as positive values. I am not sure if this is a valid transformation approach. If it is, how do I use the output from proc iml in proc glimmix and back-transform the means?
LNetNit = log10(NetNit + 1 - min(NetNit )); /* translate, then transform */
I was hoping to get positive values with the code below but I ended up having missing and negative values.
LogNetNit = j(nrow(NetNit ),1,.); /* allocate missing */
Y = NetNit + 1 - min(NetNit ); /* <== use the translated data */
idx = loc(Y > 0); /* find indices where Y > 0 */
if ncol(idx) > 0 then
LogNetNit[idx] = log10(Y[idx]);
Thank you,
> I was hoping to get positive values with the code below but I ended up having missing and negative values.
The code will give you only nonnegative values for Y. If NetNit is missing, then Y will be missing (as it should). The code translates the data by some data-dependent value into the interval [1, infinity).
The interpretation is that you are measuring the data using some different baseline reference. For example, if you measure elevation from sea level, the elevations of Death Valley and the Mariana Trench are negative. But if you measure from one meter below the bottom of the Mariana Trench, then all elevations on earth are positive. In the language of distributions, you are translating the data distribution so that it has a new mean, but preserving other properties of the distribution.
I don't know your model, so I can't really comment on PROC GLMMIX. But I encourage you to consider whether you should log-transform negative values in the first place.
Hello,
I have some data on net nitrogen mineralization and the values range from negative to positive. I measured nitrogen mineralization over several days and obtained the net nitrogen mineralization. I tried the approach below but could not obtain an output to merge to my data set.
Thanks,
proc iml;
use work.idnet2;
read all var {NetNit };
LNetNit = log10(NetNit + 1 - min(NetNit )); /* translate, then transform */
LogNetNit = j(nrow(NetNit ),1,.); /* allocate missing */
idx = loc(NetNit > 0); /* find indices where Y > 0 */
if ncol(idx) > 0 then
LogNetNit [idx] = log10(NetNit [idx]);
print NetNit LNetNit LogNetNit ;
How do I obtain my output for further analysis? How do I obtain back-transformed means and standard errors??
With the LNetNit transformation, all values were positive? Is this acceptable?
With the LogNeNit, I had a lot of missing data and negative values.
Plz post it at IML forum since it is about SAS/IML .
And calling @Rick_SAS
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.