Dear all, I am conducting a bootstrap exercise for my research. So I have to conduct a replication for each replication. Due to model restrictions, I have to constrain the coefficient of the one of the two explanatory variables to an also simulated variable. I couldn't do that with proc reg since the restriction must be a variable defined in the afore model statement. I am trying to do it within IML with a loop. The problem is how to define the restriction in the beta estimation. Below is my macro code. I want to set the coefficient estimate R_BETA equal to the value of Ret_var for replication. %macro reg_loop; %do j=1 %to 2500; DATA Cross; set Mcb.Cross; if replicate=&j; Data Variance; set Mcb.Variance if replicate=&j; run; PROC IML; use Cross; read all var {CF_BETA R_BETA} into X; read all var {eret_mean} into Y; use Variance; real all var{Ret_var} into Restr; /************************************************************************************* * I believe I need a small ``trick'' here. * *************************************************************************************/ n=nrow(X); k=ncol(X); X=J(n,1,1)||X; C=inv(X`*X); B_Hat=C*X`*Y; /************************************************************************************/ SSE=y`*y-B_Hat`*X`*Y; DFE=n-k-1; MSE=SSE/DFE; Mean_Y=Sum(Y)/n; SSR=B_Hat`*X`*Y-n*Mean_Y**2; MSR=SSR/k; SST=SSR+SSE; F=MSR/MSE; SE=SQRT(vecdiag(C)#MSE); T=B_Hat/SE; PROBT=2*(1-CDF('T', ABS(T), DFE)); B_Hat = B_Hat`; SE = SE`; T = T`; PROBT = PROBT`; ANOVA_Table=(k||SSR||MSR||F||DFE||SSE||MSE); STATS_Table=B_Hat||SE||T||PROBT; create x from ANOVA_Table; append from ANOVA_Table; create y from STATS_Table; append from STATS_Table; quit; data x; set x; replicate=&j; run; data y; set y; replicate=&j; run; proc datasets library=work; append base=work.x1 data=work.x force; proc datasets library=work; append base=work.y1 data=work.y force; quit; %end; %mend reg_loop; %reg_loop; Do you have any suggestions? Any idea will be much appreciated! Thank you for you time and help. Dimos
... View more