<?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 Clear log window contents inside do loops in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44441#M232</link>
    <description>How can I clear the contents of log window inside proc iml and do loop? As after certain interation, there is a message tell me that log window is full so how can I prevent this message?</description>
    <pubDate>Tue, 05 Apr 2011 18:17:13 GMT</pubDate>
    <dc:creator>aya123</dc:creator>
    <dc:date>2011-04-05T18:17:13Z</dc:date>
    <item>
      <title>Clear log window contents inside do loops</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44441#M232</link>
      <description>How can I clear the contents of log window inside proc iml and do loop? As after certain interation, there is a message tell me that log window is full so how can I prevent this message?</description>
      <pubDate>Tue, 05 Apr 2011 18:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44441#M232</guid>
      <dc:creator>aya123</dc:creator>
      <dc:date>2011-04-05T18:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log window contents inside do loops</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44442#M233</link>
      <description>What is getting printed out to the log window? Can you show us your code?</description>
      <pubDate>Tue, 05 Apr 2011 18:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44442#M233</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2011-04-05T18:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log window contents inside do loops</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44443#M234</link>
      <description>libname sasdata "C:\Users\pcname\Desktop\mysas";&lt;BR /&gt;
&lt;BR /&gt;
Proc iml;&lt;BR /&gt;
P=3  ;  n=50 ;  nruns=50; B= {1, 1, 1}; sum1=0;&lt;BR /&gt;
X1= {0.0396637&lt;BR /&gt;
0.7041423&lt;BR /&gt;
0.5965423&lt;BR /&gt;
3.7637131&lt;BR /&gt;
1.9483883&lt;BR /&gt;
0.6426752&lt;BR /&gt;
4.5774973&lt;BR /&gt;
2.8115605&lt;BR /&gt;
1.7396808&lt;BR /&gt;
-2.328225&lt;BR /&gt;
-1.555311&lt;BR /&gt;
1.9304524&lt;BR /&gt;
-0.438061&lt;BR /&gt;
-2.100597&lt;BR /&gt;
4.1315962&lt;BR /&gt;
-2.043585&lt;BR /&gt;
1.7933469&lt;BR /&gt;
-2.752522&lt;BR /&gt;
2.3937606&lt;BR /&gt;
1.6584021&lt;BR /&gt;
-3.464741&lt;BR /&gt;
-0.948967&lt;BR /&gt;
-0.700051&lt;BR /&gt;
0.9235539&lt;BR /&gt;
1.0683674&lt;BR /&gt;
0.1133843&lt;BR /&gt;
-0.584628&lt;BR /&gt;
-3.467575&lt;BR /&gt;
2.480151&lt;BR /&gt;
-0.23564&lt;BR /&gt;
-0.449791&lt;BR /&gt;
3.8318656&lt;BR /&gt;
-1.594308&lt;BR /&gt;
3.2146945&lt;BR /&gt;
-1.972683&lt;BR /&gt;
-2.409909&lt;BR /&gt;
-1.222361&lt;BR /&gt;
-1.850948&lt;BR /&gt;
-2.457552&lt;BR /&gt;
-2.786037&lt;BR /&gt;
0.3688551&lt;BR /&gt;
-0.745163&lt;BR /&gt;
0.661344&lt;BR /&gt;
0.9002574&lt;BR /&gt;
-4.056465&lt;BR /&gt;
-0.616641&lt;BR /&gt;
-0.433525&lt;BR /&gt;
0.893546&lt;BR /&gt;
0.5791517&lt;BR /&gt;
0.1619015}; &lt;BR /&gt;
x2={2.2098305&lt;BR /&gt;
2.4159765&lt;BR /&gt;
1.4874399&lt;BR /&gt;
4.4362109&lt;BR /&gt;
2.2857215&lt;BR /&gt;
1.3777612&lt;BR /&gt;
3.3380025&lt;BR /&gt;
2.7249503&lt;BR /&gt;
2.0605257&lt;BR /&gt;
-4.323939&lt;BR /&gt;
0.8696841&lt;BR /&gt;
-0.296454&lt;BR /&gt;
-1.572753&lt;BR /&gt;
-4.024938&lt;BR /&gt;
3.9134578&lt;BR /&gt;
0.4531205&lt;BR /&gt;
4.9395914&lt;BR /&gt;
-6.149045&lt;BR /&gt;
1.7525422&lt;BR /&gt;
0.7839797&lt;BR /&gt;
-5.230953&lt;BR /&gt;
-6.2818&lt;BR /&gt;
0.4636905&lt;BR /&gt;
-2.611297&lt;BR /&gt;
0.7944336&lt;BR /&gt;
-3.29826&lt;BR /&gt;
1.6261934&lt;BR /&gt;
-3.250607&lt;BR /&gt;
-0.745343&lt;BR /&gt;
1.3766689&lt;BR /&gt;
-3.611049&lt;BR /&gt;
1.9873417&lt;BR /&gt;
-1.146432&lt;BR /&gt;
3.7802815&lt;BR /&gt;
-0.053812&lt;BR /&gt;
-4.514641&lt;BR /&gt;
0.7478499&lt;BR /&gt;
2.7953156&lt;BR /&gt;
-1.689206&lt;BR /&gt;
-4.303781&lt;BR /&gt;
3.6997174&lt;BR /&gt;
-0.822928&lt;BR /&gt;
-1.584738&lt;BR /&gt;
5.2773745&lt;BR /&gt;
-4.61168&lt;BR /&gt;
4.6989522&lt;BR /&gt;
-4.669677&lt;BR /&gt;
1.065509&lt;BR /&gt;
-0.162652&lt;BR /&gt;
3.5672716};&lt;BR /&gt;
x3 = {2.5610138&lt;BR /&gt;
2.4568404&lt;BR /&gt;
3.3860373&lt;BR /&gt;
4.2793987&lt;BR /&gt;
2.1869485&lt;BR /&gt;
3.9195027&lt;BR /&gt;
5.1350544&lt;BR /&gt;
1.2754415&lt;BR /&gt;
4.0789311&lt;BR /&gt;
-5.643419&lt;BR /&gt;
4.2400767&lt;BR /&gt;
-0.864723&lt;BR /&gt;
-1.759528&lt;BR /&gt;
-0.609483&lt;BR /&gt;
3.9374213&lt;BR /&gt;
6.3893745&lt;BR /&gt;
2.8841345&lt;BR /&gt;
-8.918494&lt;BR /&gt;
-4.130928&lt;BR /&gt;
-1.670308&lt;BR /&gt;
-3.661193&lt;BR /&gt;
-6.988873&lt;BR /&gt;
1.7714041&lt;BR /&gt;
2.1092845&lt;BR /&gt;
4.00296&lt;BR /&gt;
-5.230733&lt;BR /&gt;
-2.968761&lt;BR /&gt;
0.0599031&lt;BR /&gt;
2.1487263&lt;BR /&gt;
-1.713545&lt;BR /&gt;
-3.31429&lt;BR /&gt;
3.96951&lt;BR /&gt;
-2.560647&lt;BR /&gt;
3.0266561&lt;BR /&gt;
-1.841822&lt;BR /&gt;
-5.536233&lt;BR /&gt;
-0.169626&lt;BR /&gt;
2.4713955&lt;BR /&gt;
-4.17196&lt;BR /&gt;
-4.926937&lt;BR /&gt;
1.6750868&lt;BR /&gt;
1.7033197&lt;BR /&gt;
-3.928748&lt;BR /&gt;
4.4535524&lt;BR /&gt;
-2.799376&lt;BR /&gt;
1.2370943&lt;BR /&gt;
-3.769872&lt;BR /&gt;
2.9396264&lt;BR /&gt;
-1.806647&lt;BR /&gt;
5.5282356};&lt;BR /&gt;
Xt1 = t(x1);&lt;BR /&gt;
xt2=t(x2);&lt;BR /&gt;
xt3=t(x3);&lt;BR /&gt;
xt=xt1 || xt2||xt3;&lt;BR /&gt;
Do j=1 to nruns;&lt;BR /&gt;
E= normal(repeat(-1,n));&lt;BR /&gt;
Y=xt* B+E;&lt;BR /&gt;
 my = y[:,];&lt;BR /&gt;
 m1 = xt1[:,];&lt;BR /&gt;
 m2 = xt2[:,];&lt;BR /&gt;
 m3 = xt3[:,];&lt;BR /&gt;
ny =(y-my)/sqrt(t(y-my)*(y-my));&lt;BR /&gt;
nX1 =(xt1-m1)/sqrt (t(xt1-m1)*(xt1-m1));&lt;BR /&gt;
nX2 =(xt2-m2)/sqrt(t(xt2-m2)*(xt2-m2));&lt;BR /&gt;
nX3 =(xt3-m3)/sqrt(t(xt3-m3)*(xt3-m3));&lt;BR /&gt;
nx= nx1||nx2||nx3;&lt;BR /&gt;
covar=xt`*xt/(nrow(xt)-1);                                &lt;BR /&gt;
gdiag=diag(covar);    &lt;BR /&gt;
gg=sqrt(inv(gdiag));  &lt;BR /&gt;
R=gg*covar*gg; &lt;BR /&gt;
val = eigval(R);&lt;BR /&gt;
vec = eigvec(R);&lt;BR /&gt;
call eigen (lambda, v, R);&lt;BR /&gt;
vt = t(v);&lt;BR /&gt;
beta=inv(nx`*nx)*nx`*ny;&lt;BR /&gt;
beta2=beta##2;&lt;BR /&gt;
g = vt * beta;&lt;BR /&gt;
lenght = t(beta)*beta;&lt;BR /&gt;
&lt;BR /&gt;
start CorrCoef(x, y) ; &lt;BR /&gt;
xStd = standard(x) ; &lt;BR /&gt;
yStd = standard(y) ;&lt;BR /&gt;
df = nrow(x) - 1; &lt;BR /&gt;
return ( xStd` * yStd / df ) ;&lt;BR /&gt;
finish;&lt;BR /&gt;
r1 = CorrCoef(ny, nx1) ;&lt;BR /&gt;
r2 = CorrCoef(ny, nx2) ;&lt;BR /&gt;
r3 = CorrCoef(ny, nx3) ;&lt;BR /&gt;
&lt;BR /&gt;
rxy= r1// r2// r3;&lt;BR /&gt;
thrd = t(rxy) * v ;&lt;BR /&gt;
sixth = t(rxy) * v;     &lt;BR /&gt;
uhat = ny - nx*beta;               &lt;BR /&gt;
RSS=ssq(uhat);                    &lt;BR /&gt;
estvar = RSS/(nrow(ny)-p); &lt;BR /&gt;
col1=vt[,1];&lt;BR /&gt;
col2=vt[,2];&lt;BR /&gt;
col3=vt[,3];&lt;BR /&gt;
reset storage = sasdata.mlibrary;&lt;BR /&gt;
store estvar lambda col1 col2 col3 g;&lt;BR /&gt;
&lt;BR /&gt;
nybar = sum(ny)/ nrow(ny);                  &lt;BR /&gt;
TSS = ny`*ny-nrow(ny)*nybar**2;&lt;BR /&gt;
ESS= TSS-RSS;&lt;BR /&gt;
MSX= ESS/ (p-1);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Elkh1 = (estvar/beta2[1])+1/lambda[1];&lt;BR /&gt;
Elkh2 = (estvar/beta2[2])+1/lambda[2];&lt;BR /&gt;
Elkh3 = (estvar/beta2[3])+1/lambda[3];&lt;BR /&gt;
Elkham= Elkh1// Elkh2// Elkh3;&lt;BR /&gt;
&lt;BR /&gt;
Newx1=nx2||nx3;&lt;BR /&gt;
Be1=inv(t(newx1)*newx1)*t(newx1)*nx1;&lt;BR /&gt;
Hat1 = nx1-newx1*be1;               &lt;BR /&gt;
RS1=ssq(hat1);                    &lt;BR /&gt;
Nx1bar = sum(nx1)/ nrow(nx1);                  &lt;BR /&gt;
TS1 = nx1`*nx1-nrow(nx1)#nx1bar##2;&lt;BR /&gt;
R21=1-RS1/TS1;&lt;BR /&gt;
Vif1=1/1-r21;&lt;BR /&gt;
&lt;BR /&gt;
Newx2=nx1||nx3;&lt;BR /&gt;
Be2=inv(newx2`*newx2)*newx2`*nx2;&lt;BR /&gt;
Hat2 = nx2-newx2*be2;               &lt;BR /&gt;
RS2=ssq(hat2);                    &lt;BR /&gt;
Nx2bar = sum(nx2)/ nrow(nx2);                  &lt;BR /&gt;
TS2 = nx2`*nx2-nrow(nx2)#nx2bar##2;&lt;BR /&gt;
R22=1-RS2/TS2;&lt;BR /&gt;
Vif2=1/1-r22;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Newx3=nx1||nx2;&lt;BR /&gt;
Be3=inv(newx3`*newx3)*newx3`*nx3;&lt;BR /&gt;
Hat3 = nx3-newx3*be3;               &lt;BR /&gt;
RS3=ssq(hat3);                    &lt;BR /&gt;
Nx3bar = sum(nx3)/ nrow(nx3);                  &lt;BR /&gt;
TS3 = nx3`*nx3-nrow(nx3)#nx3bar##2;&lt;BR /&gt;
R23=1-RS3/TS3;&lt;BR /&gt;
Vif3=1/1-r23;&lt;BR /&gt;
&lt;BR /&gt;
Vif=vif1//vif2//vif3;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
start fun(K);&lt;BR /&gt;
sumf=0;&lt;BR /&gt;
do i = 1 to 3;&lt;BR /&gt;
reset storage = sasdata.mlibrary;&lt;BR /&gt;
load estvar lambda g;&lt;BR /&gt;
sumf = sumf + (estvar*lambda&lt;I&gt;)+ (g&lt;I&gt;* k)**2  /(lambda&lt;I&gt;+  k)**2;&lt;BR /&gt;
end;&lt;BR /&gt;
return (sumf);&lt;BR /&gt;
finish 	fun;&lt;BR /&gt;
start con(k);&lt;BR /&gt;
c=j(4,1,0);&lt;BR /&gt;
sumc1=0;&lt;BR /&gt;
do i = 1 to 3;&lt;BR /&gt;
reset storage = sasdata.mlibrary;&lt;BR /&gt;
load  lambda col1 ;&lt;BR /&gt;
sumc1 = sumc1 + (col1&lt;I&gt;**2 *lambda&lt;I&gt;/(lambda&lt;I&gt;+k)**2);&lt;BR /&gt;
end;&lt;BR /&gt;
c[1]= 10-sumc1;&lt;BR /&gt;
sumc2=0;&lt;BR /&gt;
do i= 1 to 3;&lt;BR /&gt;
reset storage = sasdata.mlibrary;&lt;BR /&gt;
load  lambda col2 ;&lt;BR /&gt;
sumc2 = sumc2 + (col2&lt;I&gt;**2 *lambda&lt;I&gt;/(lambda&lt;I&gt;+k)**2);&lt;BR /&gt;
end;&lt;BR /&gt;
c[2]= 10-sumc2;&lt;BR /&gt;
sumc3=0;&lt;BR /&gt;
do i= 1 to 3;&lt;BR /&gt;
reset storage = sasdata.mlibrary;&lt;BR /&gt;
load  lambda col3 ;&lt;BR /&gt;
sumc3 = sumc3 + (col3&lt;I&gt;**2 *lambda&lt;I&gt;/(lambda&lt;I&gt;+k)**2);&lt;BR /&gt;
end;&lt;BR /&gt;
c[3]= 10-sumc3;&lt;BR /&gt;
c[4]=(max(lambda)/min(lambda))-(max(lambda)+k)/(min(lambda)+k);&lt;BR /&gt;
return (c);&lt;BR /&gt;
finish con;&lt;BR /&gt;
k=j(1,1,0);&lt;BR /&gt;
optn=j(1,11,.); optn[4]=1; optn[6]=2; optn[11]=0; optn[10]=4;&lt;BR /&gt;
call nlpqn (rc, kres,  "fun", k, optn) nlc="con";&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
mse1=0;&lt;BR /&gt;
do i = 1 to 3;&lt;BR /&gt;
mse1 = mse1 + (estvar*lambda&lt;I&gt;)+ (g&lt;I&gt;* k)**2  /(lambda&lt;I&gt;+  k)**2;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Sum1 = sum1+ MSE1; &lt;BR /&gt;
&lt;BR /&gt;
End;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Sumbar1 = sum1/nruns;&lt;BR /&gt;
&lt;BR /&gt;
Print sumbar1;&lt;BR /&gt;
quit;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Tue, 05 Apr 2011 18:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44443#M234</guid>
      <dc:creator>aya123</dc:creator>
      <dc:date>2011-04-05T18:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log window contents inside do loops</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44444#M235</link>
      <description>Turn off the notes output by adding the statement:&lt;BR /&gt;
&lt;BR /&gt;
option nonotes;&lt;BR /&gt;
&lt;BR /&gt;
before the proc iml statement.</description>
      <pubDate>Tue, 05 Apr 2011 19:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Clear-log-window-contents-inside-do-loops/m-p/44444#M235</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2011-04-05T19:07:12Z</dc:date>
    </item>
  </channel>
</rss>

