That is almost what is wanted. You need to eliminate the ID statement from the last transpose. Also you need to eliminate the missing values . data have; input patient_number color $ congruence $ trial $ t1 t2 t3 t4 ; cards; 1 GREEN NO ERROR 262 588 510 714 1 RED NO ERROR 931 449 307 460 1 BLUE NO ERROR 672 654 592 . 1 YELLOW NO ERROR 752 568 . . 1 GREEN NO GOOD 743 697 999 . 1 RED NO GOOD 1087 630 590 . 1 BLUE NO GOOD 192 240 . . 1 YELLOW NO GOOD 235 756 345 . ; run; proc transpose data=have out=temp(where=(col1 ne .)); by patient_number congruence trial color notsorted; var t1-t4; run; proc transpose data=temp out=want(drop=_:) prefix=T; by patient_number congruence trial; var col1; run;
... View more