<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc MI: impute only some missing values and select range of imputed values in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-MI-impute-only-some-missing-values-and-select-range-of/m-p/709660#M34364</link>
    <description>&lt;P&gt;Hallo everybody,&lt;/P&gt;&lt;P&gt;I am working with a database that looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;                    
input id trt $ var1 $ var2 $;
datalines; 
1 placebo 0.2 3.0
2 placebo 1.1 &amp;lt;1.0
3 drug &amp;lt;0.2 2.0
4 placebo 2.3 .
5 drug &amp;lt;0.2 2.2
6 drug . 1.2
; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see I have missing values and values that are reported as "below the limit of detection" from the laboratory.&lt;/P&gt;&lt;P&gt;My aim is to use multiple imputation to impute ONLY the values under the limit of detection and not the real missing values.&lt;/P&gt;&lt;P&gt;To do this&amp;nbsp; I differentiated the two "kinds" of missing values like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; set have;
		if var1='' then var1_n=.a;
	else if var1 ne '' then var1_n = input(var1, 8.);
	if var1_n=. then var1_n=.b;

		if var2='' then var2_n=.a;
	else if var2 ne '' then var2_n = input(var2, 8.);
	if var2_n=. then var2_n=.b;

	drop var1 var2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now A are real missing values and B are values below detection limit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;1) Is it possible to use proc mi specifing that I want to impute only the missing values specified with B and not all missing values?&lt;/P&gt;&lt;P&gt;2) Is there an option in proc mi to specify that the imputed values should be between 0 and the limit of detection (for example for var1 between 0 and 0.2)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Version: 9.4&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 16:57:20 GMT</pubDate>
    <dc:creator>riccardo88</dc:creator>
    <dc:date>2021-01-06T16:57:20Z</dc:date>
    <item>
      <title>Proc MI: impute only some missing values and select range of imputed values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-MI-impute-only-some-missing-values-and-select-range-of/m-p/709660#M34364</link>
      <description>&lt;P&gt;Hallo everybody,&lt;/P&gt;&lt;P&gt;I am working with a database that looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;                    
input id trt $ var1 $ var2 $;
datalines; 
1 placebo 0.2 3.0
2 placebo 1.1 &amp;lt;1.0
3 drug &amp;lt;0.2 2.0
4 placebo 2.3 .
5 drug &amp;lt;0.2 2.2
6 drug . 1.2
; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see I have missing values and values that are reported as "below the limit of detection" from the laboratory.&lt;/P&gt;&lt;P&gt;My aim is to use multiple imputation to impute ONLY the values under the limit of detection and not the real missing values.&lt;/P&gt;&lt;P&gt;To do this&amp;nbsp; I differentiated the two "kinds" of missing values like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; set have;
		if var1='' then var1_n=.a;
	else if var1 ne '' then var1_n = input(var1, 8.);
	if var1_n=. then var1_n=.b;

		if var2='' then var2_n=.a;
	else if var2 ne '' then var2_n = input(var2, 8.);
	if var2_n=. then var2_n=.b;

	drop var1 var2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now A are real missing values and B are values below detection limit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;1) Is it possible to use proc mi specifing that I want to impute only the missing values specified with B and not all missing values?&lt;/P&gt;&lt;P&gt;2) Is there an option in proc mi to specify that the imputed values should be between 0 and the limit of detection (for example for var1 between 0 and 0.2)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Version: 9.4&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 16:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-MI-impute-only-some-missing-values-and-select-range-of/m-p/709660#M34364</guid>
      <dc:creator>riccardo88</dc:creator>
      <dc:date>2021-01-06T16:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc MI: impute only some missing values and select range of imputed values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-MI-impute-only-some-missing-values-and-select-range-of/m-p/709665#M34365</link>
      <description>&lt;P&gt;1) Is it possible to use proc mi specifing that I want to impute only the missing values specified with B and not all missing values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes. The though process would be a bit different than state: Where the value is not .A. You can use a data step option : data=have (where=(var1_n ne .A)).&lt;/P&gt;
&lt;P&gt;Since you have two (or possibly more variables) that would involve a separate imputation step for each variable individually since the subset of records is different for each Variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Is there an option in proc mi to specify that the imputed values should be between 0 and the limit of detection (for example for var1 between 0 and 0.2)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Proc MI statement options MINIMUM= and MAXIMUM= set the limits on imputed values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 17:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-MI-impute-only-some-missing-values-and-select-range-of/m-p/709665#M34365</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-06T17:21:48Z</dc:date>
    </item>
  </channel>
</rss>

