<?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: Replace all missing values of multiple variables with MODE in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701915#M25842</link>
    <description>Couple of minutes of searching found these, why don't you try some and see which one meets your needs. I unfortunately do not have the time to mock up example data and a solution at the moment. Someone else may offer an alternative option. The macro would be my starting approach.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.listendata.com/2014/11/sas-macro-imputing-missing-data.html" target="_blank"&gt;https://www.listendata.com/2014/11/sas-macro-imputing-missing-data.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/26922779/fill-in-missing-values-with-mode-in-sas" target="_blank"&gt;https://stackoverflow.com/questions/26922779/fill-in-missing-values-with-mode-in-sas&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or something way more complicated:&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/multiple-imputation-in-sas/mi_new_1/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/multiple-imputation-in-sas/mi_new_1/&lt;/A&gt;</description>
    <pubDate>Thu, 26 Nov 2020 21:14:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-11-26T21:14:10Z</dc:date>
    <item>
      <title>Replace all missing values of multiple variables with MODE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701897#M25837</link>
      <description>&lt;P&gt;I am trying to replace all missing values with Mode. I have tried PROC STDIZE but it does not support Mode as replacement method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc stdize data = have&amp;nbsp; out = want&amp;nbsp; reponly&amp;nbsp; method = ???? ;&lt;BR /&gt;var _character_ ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 20:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701897#M25837</guid>
      <dc:creator>hastm</dc:creator>
      <dc:date>2020-11-26T20:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replace all missing values of multiple variables with MODE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701904#M25838</link>
      <description>It does have an IN method that allows you to build your most freq table and then use that drive your recoding.</description>
      <pubDate>Thu, 26 Nov 2020 21:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701904#M25838</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-26T21:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replace all missing values of multiple variables with MODE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701908#M25840</link>
      <description>can you please share some code to give me an idea</description>
      <pubDate>Thu, 26 Nov 2020 21:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701908#M25840</guid>
      <dc:creator>hastm</dc:creator>
      <dc:date>2020-11-26T21:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace all missing values of multiple variables with MODE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701915#M25842</link>
      <description>Couple of minutes of searching found these, why don't you try some and see which one meets your needs. I unfortunately do not have the time to mock up example data and a solution at the moment. Someone else may offer an alternative option. The macro would be my starting approach.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.listendata.com/2014/11/sas-macro-imputing-missing-data.html" target="_blank"&gt;https://www.listendata.com/2014/11/sas-macro-imputing-missing-data.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/26922779/fill-in-missing-values-with-mode-in-sas" target="_blank"&gt;https://stackoverflow.com/questions/26922779/fill-in-missing-values-with-mode-in-sas&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or something way more complicated:&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/multiple-imputation-in-sas/mi_new_1/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/multiple-imputation-in-sas/mi_new_1/&lt;/A&gt;</description>
      <pubDate>Thu, 26 Nov 2020 21:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/701915#M25842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-26T21:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace all missing values of multiple variables with MODE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/702030#M25851</link>
      <description>&lt;PRE&gt;%let dsn= sashelp.heart;

ods select none;
ods output onewayfreqs=freq;
proc freq data=&amp;amp;dsn ;
table _character_ ;
run;
ods select all;

data mode;
 set freq(drop=table);
 _level_=coalescec(of _character_);
 keep frequency _level_;
run;
data mode1;
 merge 	freq(keep=table) mode;
run;
proc sort data=mode1 out=mode2;by table frequency;run;
data mode3;
 set mode2;
 by table;
 table=upcase(scan(table,-1,' '));
 if last.table;
 drop frequency;
run;

data want;
 set &amp;amp;dsn ;
 array x{*} $ _character_;

if _n_=1 then do;
 if 0 then set mode3;
 declare hash h(dataset:'mode3');
 h.definekey('table');
 h.definedata('_level_');
 h.definedone();
end;
 do i=1 to dim(x);
  if missing(x{i}) then do;h.find(key:upcase(vname(x{i})));x{i}=_level_;end;
 end;
 drop i _level_ table;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 13:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Replace-all-missing-values-of-multiple-variables-with-MODE/m-p/702030#M25851</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-11-27T13:52:54Z</dc:date>
    </item>
  </channel>
</rss>

