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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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.