Hi I am familiar with SQL and VBA, and now trying to learn how to use SAS. I would appreciate your help. I have a data set that is two columns: column ID (set to 1 or 2) and column Value. Let's say I have 100 observations. Let's call this data set as array(x,y) where x is rows so goes from 1 to 100, and y is columns so goes from 1 to 2. array(x,1) is the ID column, and array(x,2) is the Value column. I also need a correlation matrix between each of the 100 observations, say corr(i,j). I want to produce the sum of the values of the 100 observations allowing for the correlations between them. I can achieve this by doing matrix multiplication of array(x,2) with itself transposed and with corr(i,j), square-rooted. If I was working in VBA I may do something like: Total1 = 0 Total2 = 0 For a = 1 to 100 For b = 1 to 100 result = array(a,2) * array(b,2) * corr(a,b) Total1 = Total1 + result Next b Total2 = Total2 + Total1 Next a Total = Total2^(1/2) corr(i,j) needs to be set.. - to 1 where i=j, - to 0.5 where i <> j and array(i,1) <> array(j,1) i.e. different IDs, - to 0 otherwise How can I do this in SAS Enterprise? Is using a Do query the best approach or is there a direct matrix multiplication approach? Many thanks in advance Josh
... View more