...Yes, the IML.
Here is the deal. The documentation for SAS data set arrays should explain how the notation array help(1) refers to a nx1 vector of observations (as a group), not the first component of the 1-D vector array help.
Further:
Say test has 3 variables v1 -v3 (columns) and 10 observations (rows):
data check;
set test_data;
array input(3) v1-v3;
array out(3)_temporary_;
. .do i=1 to 3;
. .out(i)=reps(1)*reps(i);
end;
%put out;
run;
Now, if you were new to SAS, you would assume out(i)=reps(1)*reps(i);
is the product of the scalar valued first entry in reps with the scalar valued ith entry in reps.
However, reps(i) refers to the vector of 10 observations in the ith column of reps. Further, even if you know rep(i) is a vector the line:
out(i)=reps(1)*reps(i);
appears to be a vector operation!!! (since out(i), reps(1), reps(i) are all 10x1 vectors)
However, SAS has the implicit itteration built into the data statment. Assume this itteration is on the first row of test_data, so that _N_=1. Even though,
we appear to be referencing vector quantities in: out(i)=reps(1)*reps(i);
SAS actually still performs the operation in: out(i)=reps(1)*reps(i)
entry by entry corresponding to the rows of the original dataset.
In other words, lets say we have all 1's in test_data, then chronologically, this how SAS populates array out:
1 1 1 ' ' ' ' 1 1 1 ' ' ' ' 1 1 1
. . . ' ' ' ' ' ' 1 1 1 ' ' ' ' 1 1 1
. . . ' ' ' ' ' ' . . . ' ' ' ' ' ' 1 1 1 and so on.....
---- time --->
(the .'s are blank entries in the array
the ' are just for space)
I do not think it is clear at all, that SAS should operate this way. Basically, SAS has preprogramed opperations going on behind the surface, and notation which looks similiar to common notation in other languages, including Math, but which actually means something different.........
Message was edited by: vasudeva
Message was edited by: vasudeva
Message was edited by: vasudeva
Message was edited by: vasudeva
Message was edited by: vasudeva