Hi @jamsher79,
Computations like these (subtracting a location measure and possibly dividing by a scale measure -- known as standardizing) can also be performed by PROC STDIZE (if SAS/STAT is available). This procedure operates on variables (i.e. columns), not observations (rows), though. But with PROC TRANSPOSE you can transpose your "matrices" as needed.
Here's a small 3x2 example:
data a;
input val1 val2;
cards;
1 3
2 5
4 8
;
proc transpose data=a out=at;
var val:;
run;
proc stdize data=at out=s method=mean;
var col:;
run;
proc transpose data=s out=b(drop=_:) prefix=sval;
run;
proc print data=b noobs;
run;
sval1 sval2
-1.0 1.0
-1.5 1.5
-2.0 2.0
So, PROC STDIZE using the option METHOD=MEAN has computed the means (val1+val2)/2, subtracted them from the original values val1, val2 and would have divided the differences by 1, the scale measure for this METHOD, if that had an impact. I've named the resulting variables sval1 and sval2. The PROC TRANSPOSE steps would be unnecessary if you were happy to work with transposed matrices (40x108 in your case). Please note that nowhere in the code the dimensions of matrix A had to be specified.
Compare this to the "Data Step Solution".
... View more