<?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 to fix this PROC MI MICRO problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-fix-this-PROC-MI-MICRO-problem/m-p/433165#M2187</link>
    <description>&lt;P&gt;PROC MI is in SAS/STAT, so it is better to ask in that community.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2018 16:24:39 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2018-02-01T16:24:39Z</dc:date>
    <item>
      <title>how to fix this PROC MI MICRO problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-fix-this-PROC-MI-MICRO-problem/m-p/433163#M2186</link>
      <description>&lt;P&gt;Hello, I am trying to do some imputation with SAS, and repeated with fixed seed. I tried a simple one. it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I change the data and codes:&amp;nbsp; 1. x and y are category var while v and w are continuous var; 2 add out=out_data; 3. change imputation method from MCMC to FCS;&amp;nbsp; It did not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a beginner for MACRO. Could anyone help me for this problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*work*/
data eq;
input y x z w;
cards;
1 23 45 19
0 32 20 .
1 67 . .
1 . . .
;
run;

%macro mi(in_data);
	proc mi data = &amp;amp;in_data nimpute=&amp;amp;n_imp seed= &amp;amp;&amp;amp;my_seed&amp;amp;i;
		mcmc chain=multiple  initial=em(itprint);
   		var y x z w;
	run;
%mend mi;

%macro try(in_data,n_imp,in_seed,n_boot);
	data seed_long(drop=i);
  		call streaminit(&amp;amp;in_seed);
  		do i = 1 to &amp;amp;n_boot;
    		x_seed = floor(rand("Uniform")*500000); output;
  		end;
	run;

 	data _null_;
 		set seed_long;
 		call symput('my_seed'|| compress(put(_n_,8.)), x_seed);
 	run;

   %let i=1;
   %do %until (&amp;amp;i&amp;gt;&amp;amp;n_boot) ;
	  %mi(&amp;amp;in_data)
      %let i = %eval(&amp;amp;i+1);
   %end;
%mend try;

%try(eq,5,123,3)
%put _global_;


/*not work*/
data eq1;
input ID y x z w;
cards;
1 1 23 0 19
2 0 32 1 .
3 1 67 . .
3 1 . 1 3
;
run;

%macro mi(in_data);
	proc mi data = &amp;amp;in_data  out=out_data nimpute=&amp;amp;n_imp seed= &amp;amp;&amp;amp;my_seed&amp;amp;i;
		CLASS y;
		 FCS REG (x w)
     	LOGISTIC (y );
 	VAR y x z w;
	run;
%mend mi;

proc genmod data = out_data ; 
class ID;
model y = x z w/dist=bin; 
repeated subject=ID/type=ind;
by _imputation_; 
ods output ParameterEstimates=mvn; 
run; quit;


proc mianalyze parms=mvn;
modeleffects x;
ods output ParameterEstimates=sim_y;
run;


%macro try(in_data,n_imp,in_seed,n_boot);
	data seed_long(drop=i);
  		call streaminit(&amp;amp;in_seed);
  		do i = 1 to &amp;amp;n_boot;
    		x_seed = floor(rand("Uniform")*500000); output;
  		end;
	run;

 	data _null_;
 		set seed_long;
 		call symput('my_seed'|| compress(put(_n_,8.)), x_seed);
 	run;

   %let i=1;
   %do %until (&amp;amp;i&amp;gt;&amp;amp;n_boot) ;
	  %mi(&amp;amp;in_data)
      %let i = %eval(&amp;amp;i+1);
   %end;
%mend try;

%try(eq1,5,123,3)
%put _global_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Feb 2018 16:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-fix-this-PROC-MI-MICRO-problem/m-p/433163#M2186</guid>
      <dc:creator>pengznuc</dc:creator>
      <dc:date>2018-02-01T16:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to fix this PROC MI MICRO problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-to-fix-this-PROC-MI-MICRO-problem/m-p/433165#M2187</link>
      <description>&lt;P&gt;PROC MI is in SAS/STAT, so it is better to ask in that community.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 16:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-to-fix-this-PROC-MI-MICRO-problem/m-p/433165#M2187</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-02-01T16:24:39Z</dc:date>
    </item>
  </channel>
</rss>

