Hello, on SAS 9.4, I am trying to impute values falling below the limit of detection (LOD) for a laboratory variable (measles antibody titers). All values below 5.00 are <LOD. Rather than impute these as LOD/2 = 2.5, is there some proc I can use to impute a random distribution for this specific variable, between a specified range: 0 to 5?
I did try setting all values "<5.00" to missing (".") in a new variable, measles_imp, and running the below code - & found an error:
proc mi data=temp out=measlesimp minimum = 0 maximum = 5;
mcmc;
var measles_imp;
run;
ERROR: Fewer than two analysis variables.
I only want to do this for the one variable, so not sure what to do here. Proc hpimpute does not seem to have an option to specify the range (0-5).
A data step can replace missings with random numbers. Example:
data want;
set have;
if missing(measles_imp) then measles_imp=rand('uniform',0,5);
run;
You can't impute using that method if there is only one variable.
What is wrong with using 2.5 as the imputed value? Or a random number generator?
Thank you for your response!
Plotting the residuals of both log-transformed and non-transformed data, there is a "boundary line" due to the n=36 values set to 2.5. A biostatistician recommended that I consider doing random values within 0-5 rather than setting values at 2.5 to get a better data structure/distribution (see attached of log-transformed data).
I could use a random number generator, but was hoping to do this more automatically in SAS - Sorry I may be missing something, can SAS randomly generate those values and then automatically fill them into the missing value of the variable?
A data step can replace missings with random numbers. Example:
data want;
set have;
if missing(measles_imp) then measles_imp=rand('uniform',0,5);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.