Tuesday, May 15, 2012
Array and Proc Transpose
/* using array instead of proc transpose */
data ex;
array xx[5] x1-x5;
array yy[5] y1-y5;
input id $ x1 x2 x3 x4 x5 y1 y2 y3 y4 y5;
do time=1 to 5;
x=xx[time];
y=yy[time];
output;
end;
keep id time x y ;
datalines;
01 3 2 4 7 4 3 5 2 2 5
02 9 3 7 5 3 2 6 4 3 8
;
Obs id time x y
1 01 1 3 3
2 01 2 2 5
3 01 3 4 2
4 01 4 7 2
5 01 5 4 5
6 02 1 9 2
7 02 2 3 6
8 02 3 7 4
9 02 4 5 3
10 02 5 3 8
Subscribe to:
Posts (Atom)