# problem in doing the sas programming

#### s991102

##### New Member
proc iml;
S = 10;
N = 100;
P = 5000;
call randseed(12345);
Res = {0 , 0};
do rep = 1 to S;
X = j(N, P, .);
Y = j(N, 2, .);
call randgen(x, ’normal’);
call randgen(y, ’normal’);
Cor = corr(Y || X)[{1 2}, 3P+2)];
Res = Res + abs(Cor)[ ,<>];
end;
Res = Res / S;
print Res;
quit;

I know its the problem on Cor = corr(Y || X)[{1 2}, 3P+2)];
but can anyone tell me why its doesn't work fast and how to make changes in order to make it faster.
Thanks!!!!

#### noetsi

##### No cake for spunky
Commonly when something does not work fast in SAS it is because you have a huge data set. How many cases do you have? There are various solutions including indexing variables in your data set.

#### s991102

##### New Member
Commonly when something does not work fast in SAS it is because you have a huge data set. How many cases do you have? There are various solutions including indexing variables in your data set.
I dun understand what you mean by cases.... sorry I am new to SAS
btw how to index the variables in my data set ?

#### ted00

##### New Member
what's the main purpose of this code, i.e. what Question area you trying to solve?
isn't corr(X,Y) zero since x and y are generated independently?