BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
slh277
Calcite | Level 5

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). 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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?

--
Paige Miller
slh277
Calcite | Level 5

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?

PaigeMiller
Diamond | Level 26

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;
--
Paige Miller

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1613 views
  • 1 like
  • 2 in conversation