Hi All,
I have a dataset as below:
I need to transpose the data as below subject wise:
Any help ?
Use PROC TRANSPOSE.
proc transpose data=have out=want(drop=_name_) ;
by usubjid;
id vstestcd;
var vsorres;
run;
Note that if you will collect multiple BP readings per subject then you will probably also need to another variable to in the original dataset you can use in the BY statement so that PROC TRANSPOSE knows which pairs of SYS and DIA readings to keep together on the same output observation.
Use PROC TRANSPOSE.
proc transpose data=have out=want(drop=_name_) ;
by usubjid;
id vstestcd;
var vsorres;
run;
Note that if you will collect multiple BP readings per subject then you will probably also need to another variable to in the original dataset you can use in the BY statement so that PROC TRANSPOSE knows which pairs of SYS and DIA readings to keep together on the same output observation.
Thank you so much ! it worked !
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.