Please don't delete the question, even though you've figured out the answer. I would strongly encourage you to post the solution if you've solved it yourself. There could always be someone out there with exactly the same question as you had.
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;
Last edited by lancearmstrong1313; 03-17-2012 at 10:29 AM.
Please don't delete the question, even though you've figured out the answer. I would strongly encourage you to post the solution if you've solved it yourself. There could always be someone out there with exactly the same question as you had.
Oh Thou Perelman! Poincare's was for you and Riemann's is for me.
|
|