I have an IML programe as follows
proc iml;
a={1 2,
1 3,
2 3}
;
b=nrow(a);
c=ncol(a);
v=max(a);
cs=j(c,1,0);
do i =1 to c;
ss=0;
do j=1 to b;
if a[j,i] ^= . then ss = ss+1;
end;
cs[i,1]=ss;
end;
n=sum(cs);
d=j(n,v,0);
ss1=0;
do i = 1 to c;
do j = 1 to b;
if a[j,i] ^= . then
do;
ss1=ss1+1;
do k = 1 to v;
if a[j,i] = k then
d[ss1,k] =1;
end;
end;
end;
end;
print d;
run;
output for this is as follows
1 0 0
1 0 0
0 1 0
0 1 0
0 0 1
0 0 1
now if I replase the matrix a by
a={. 2,
. 3,
2 3}
ie we replace an element by a missing value then I get the output as
0 1 0
0 1 0
0 0 1
0 0 1
now my problem is that if I replace any element of the matrix then
the column number corresponding to that element should be deleted from
the output ie for this example I want the column number 1 to be
deleted in the ouput.
I whant the output as follows
1 0
1 0
0 1
0 1
(if we replace element 2 with a dot then in the output column 2
should be deleted)