<?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 Re: How do I impute missing values for a single variable using PROC MI? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571853#M28131</link>
    <description>&lt;P&gt;Are there any other SAS procedures made for the single variable imputation that you coud recommend using instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the rply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2019 16:17:56 GMT</pubDate>
    <dc:creator>ThomasNord</dc:creator>
    <dc:date>2019-07-08T16:17:56Z</dc:date>
    <item>
      <title>How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571727#M28122</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with forest inventory data where some field plots were not visited in the field. I would like to impute the missing values of forest cover within the plots. I have tried using PROC MI (SAS ver. 9.4), but keep getting the message: "ERROR: Fewer than two analysis variables". In the inserted code NFI2KMCL and ssu form an identifier of the plot, "forest" is wether the plot has been identified as forest (can be 1 or 2) and "A_forest" is the measured forest area, that is sometimes missing and needs to be imputed (values can only be 0 to 0.0706 hectar&amp;nbsp;as the circular plots have a radius of 15 m).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that someone can help me out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data NFI;
input nfi2kmcl ssu $  forest  A_forest;
cards;
2km_6396_588_EUREF89   C   0   0
2km_6396_588_EUREF89   E   0   0
2km_6070_660_EUREF89   E   1   0.070685835
2km_6070_660_EUREF89   G   1   0.018552237
2km_6070_662_EUREF89   A   1   .
2km_6070_662_EUREF89   G   1   .
2km_6070_666_EUREF89   A   1   .
2km_6070_666_EUREF89   G   1   .
2km_6070_672_EUREF89   C   1   0.070685835
2km_6070_672_EUREF89   E   1   0.070685835
2km_6070_672_EUREF89   G   1   0.070685835
2km_6070_688_EUREF89   A   1   0.070685835
2km_6070_688_EUREF89   E   1   0.070685835
2km_6070_688_EUREF89   G   1   0.070685835
2km_6080_524_EUREF89   C   1   0
2km_6080_524_EUREF89   E   1   0.070685835
2km_6080_526_EUREF89   A   1   .
2km_6080_526_EUREF89   G   1   .
2km_6080_528_EUREF89   A   1   .
2km_6080_528_EUREF89   C   1   .
;


proc mi data=NFI seed=501213 nimpute=6 min=0 max=0.070686 out=NFI_out;
	mcmc;
	var A_forest;
	by forest;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 10:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571727#M28122</guid>
      <dc:creator>ThomasNord</dc:creator>
      <dc:date>2019-07-08T10:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571737#M28124</link>
      <description>&lt;P&gt;What if you let it work over two variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data NFI;
input nfi2kmcl :$20. ssu $  forest  A_forest;
cards;
2km_6396_588_EUREF89   C   0   0
2km_6396_588_EUREF89   E   0   0
2km_6070_660_EUREF89   E   1   0.070685835
2km_6070_660_EUREF89   G   1   0.018552237
2km_6070_662_EUREF89   A   1   .
2km_6070_662_EUREF89   G   1   .
2km_6070_666_EUREF89   A   1   .
2km_6070_666_EUREF89   G   1   .
2km_6070_672_EUREF89   C   1   0.070685835
2km_6070_672_EUREF89   E   1   0.070685835
2km_6070_672_EUREF89   G   1   0.070685835
2km_6070_688_EUREF89   A   1   0.070685835
2km_6070_688_EUREF89   E   1   0.070685835
2km_6070_688_EUREF89   G   1   0.070685835
2km_6080_524_EUREF89   C   1   0
2km_6080_524_EUREF89   E   1   0.070685835
2km_6080_526_EUREF89   A   1   .
2km_6080_526_EUREF89   G   1   .
2km_6080_528_EUREF89   A   1   .
2km_6080_528_EUREF89   C   1   .
;

proc mi data=NFI seed=501213 nimpute=6 min=0 max=0.070686 out=NFI_out;
mcmc;
var forest A_forest;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jul 2019 11:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571737#M28124</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-08T11:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571746#M28125</link>
      <description>&lt;P&gt;Well, then it works of course, but the intention was to impute only the variable of interest. If I use some other variable just to make it run, that variable will affect the result of the imputation ... at least as far as I understand it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 11:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571746#M28125</guid>
      <dc:creator>ThomasNord</dc:creator>
      <dc:date>2019-07-08T11:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571748#M28126</link>
      <description>&lt;P&gt;It's my guess that MI uses the second variable as some kind of "help". But I'm no statistician, maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;can provide more insight.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 11:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571748#M28126</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-08T11:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571780#M28128</link>
      <description>&lt;P&gt;MI is meant to impute based on a multivariate distribution and thus needs more than 1 variable.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571780#M28128</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2019-07-08T14:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571853#M28131</link>
      <description>&lt;P&gt;Are there any other SAS procedures made for the single variable imputation that you coud recommend using instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the rply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 16:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571853#M28131</guid>
      <dc:creator>ThomasNord</dc:creator>
      <dc:date>2019-07-08T16:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values for a single variable using PROC MI?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571861#M28134</link>
      <description>&lt;P&gt;In the case of one variable, MI is similar to bootstrap resampling. For each imputed sample, you can replace each missing value with a random value from the nonzero values. For example, when forest=1, your data has&lt;/P&gt;
&lt;P&gt;1 value of 0&lt;/P&gt;
&lt;P&gt;1 value of&amp;nbsp;0.018552237&lt;/P&gt;
&lt;P&gt;8 values of&amp;nbsp;0.070685835&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not clear to me what you want to do with the forest=0 data, which doesn't have missing values. Copy it over to each imputed set?&lt;/P&gt;
&lt;P&gt;Anyway, for the forest=1 data, you can write a program such as the following to replace missing values with a random observed value:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* initial distribution of values */&lt;BR /&gt;proc freq data=NFI;
where forest=1;
tables A_forest / missprint;
run;

/* multiple imputations of the forest=1 data */
data Impute;
call streaminit(54321);
array Value[3] _temporary_ (0.070685835, 0.018552237, 0);
array Prob[3] _temporary_ (0.8, 0.1, 0.1);
set NFI(where=(Forest=1));
ObsNum = _N_;
do _Imputation_ = 1 to 5;
   if x = . then do;
      i = rand("Table", of Prob[*]);
      A_forest = Value[i];
   end;
   else ;
   output;
end;
run;

proc sort data=Impute;
   by _Imputation_ ObsNum;
run;

/* final distribution of values accross all imputed sets */
proc freq data=Impute;
   tables A_forest / missprint;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jul 2019 16:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-for-a-single-variable-using-PROC/m-p/571861#M28134</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-08T16:53:41Z</dc:date>
    </item>
  </channel>
</rss>

