我的数据集如下:
unit A1 B1 A2 B2 A3 B3 ....
.
.
.
我需要将其转换为:
unit A B
1
2
3
我可以单独转置每个:
proc transpose data=test OUT=TESTOUT;
var A1-A5 B1-B5;
BY UNIT;
但这给了我一长列而不是2
答案 0 :(得分:0)
proc transpose data=test out=test1(rename=(col1=dat));
by id;
var dat1-dat5;
run;
proc transpose data=test out=test2(rename=(col1=rec));
by id;
var rec1-rec5;
run;
data test3 (drop=_name_);
merge test1 test2;
by id;
run;