I have the following code that perfectly works:
proc iml;
a = {1,2,3,4,0};
b = {1 1, 1 2, 2 3,3 1, 2 2};
c = a||b;
d = full(c);
print a,b,c,d;
quit;
Now, I'm trying to the same thing with one row of my data but getting errors. My code is:
proc iml;
use test(keep = TR_:);
read all var _num_ into x [colname=vn];
b = t(scan(compress(vn,'S'),2,'t_') // scan(compress(vn,'S'),3,'t_'));
a = t(x);
c = a||b;
d = full(c);
print x, a, b, c, d;
quit;
I can't somehow get the matrix 'c' correctly, it is throwing some error. Can anyone please point out where I'm going wrong?
The test file is following:
Year | Segment1 | TR_S6_S5 | TR_S7_S5 | TR_S6_S7 | TR_S7_S6 | TR_S7_S8 | TR_S6_S8 | TR_S3_S1 | TR_S2_S1 | TR_S2_S3 | TR_S3_S2 | TR_S3_S4 | TR_S2_S4 | TR_S6_S2 | TR_S7_S3 | TR_S5_S1 | TR_S8_S4 | TR_S2_S6 | TR_S3_S7 |
2017 | ABC | 0.001 | 0.3 | 0 | 0 | 0.02 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |