Basically, I wanted to know how to change multiple lines for one subject to just one line per subject. For example,
rather than having data as:
ID X Time
01 1 1
01 3 2
01 5 3
02 2 1
02 4 2
03 6 1
....
....
I wanted it to look like this:
ID X1 X2 X3 X4 ..............X8
01 1 3 5 .
02 2 4 . .
03 6 . . .
....
....
I needed to use a retain statement to do this and found that I the code would be as follows:
data score1;
array Y[8] X1-X8;
retain X1-X8;
set score;
by ID;
if first.ID then do i=1 to 7;
Y[i]=.;
end;
Y[TIME]=X;
if last.ID then output;
keep ID X1-X8;
run;





Reply With Quote
