data v ;
input id vstestcd $ vsorres vsorresu $ ;
cards ;
101 sbp 120 mmhg
101 dbp 90 mmhg
101 hr 78 permin
101 pr 85 permin
102 sbp 120 mmhg
102 dbp 90 mmhg
102 hr 78 permin
102 pr 85 permin
;
i need the below output using the array/transpose from the above data
ID SBP DBP HR PR V1 v2 v3 v4
101 120 90 78 85 mmhg mmhg permin permin
102 120 90 78 85 mmhg mmhg permin permin
Assuming there is only one set of values per ID you could use two PROC TRANSPOSE steps and then merge the results.
proc transpose data=v out=numbers;
by id;
id vstestcd ;
var vsorres;
run;
proc transpose data=v out=characters suffix=_units;
by id;
id vstestcd ;
var vsorresu ;
run;
data want ;
merge numbers characters;
by id;
drop _name_;
run;
Isn't this a report?
proc report data=v;
column id (vsorres vsorresu),vstestcd;
define id / group;
define vsorres / "Value" analysis;
define vsorresu / "Unit" display;
define vstestcd / "" across;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.