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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.