I have the following dataset
| category | group | measure | value |
| height | control | mean | 55 |
| height | control | median | 54 |
| weight | control | mean | 123 |
| weight | control | median | 125 |
| height | treatment | mean | 57 |
| height | treatment | median | 56 |
| weight | treatment | mean | 147 |
| weight | treatment | median | 167 |
I am trying to transpose by category and treatment then by mean/median with values
Something like this:
| category | group | mean | median |
| height | control | 55 | 54 |
| weight | control | 123 | 125 |
| height | treatment | 57 | 56 |
| weight | treatment | 147 | 167 |
I did:
proc sort data=have; by category group;run;
proc transpose data=have out=want;
by category group;
var Value;
run;
Not working....
Hi @radhikaa4
You need to add an ID statement:
proc transpose data=have out=want (drop=_name_);
var Value;
ID measure;
by category group;
run;
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.