data test01_w(drop = h)
test01_h(drop = w);
input id $ h w @@;
cards;
A 180 56
B 167 49
C 171 51
D 160 50
E 173 51
;run;
data test01_w(drop = id);
set test01_w(rename=(w=val));
_id = compress(id||'_w');
run;
data test01_h(drop = id);
set test01_h(rename=(h=val));
_id = compress(id||'_h');
run;
data test01;
set test01_w
test01_h;
run;
proc sort data = test01;
by _id;
run;
proc transpose data = test01 out = test02(drop = _NAME_);
id _id;
run;