Hi,
with proc tabulate I have this output :
| mean | median | |
| Age | 30 | 25 |
| Revenue | 2700 | 2600 |
and what I want to have is this form :
| Age | mean | 30 |
| median | 25 | |
| Revenue | mean | 2700 |
| median | 2600 |
Is this possible?
Thanks
Based on your previous post, I edited the code because I have only numeric variables :
PROC TABULATE
DATA=SASHELP.CLASS
;
VAR Height Age;
TABLE
/* ROW Statement */
Height * Mean={LABEL="Mean"} Height={LABEL=""} * Median={LABEL="Median"}
Age * Mean={LABEL="Mean"} Age={LABEL=""} * Median={LABEL="Median"} ,
/* COLUMN statement */
ALL=' ' ;
;
RUN;
And I have the result that I want
:
| Height | Mean | 62.34 |
|---|---|---|
| Median | 62.80 | |
| Age | Mean | 13.32 |
| Median | 13.00 |
What I looked for is the " , ALL=' ' "
Thanks a lot @Reeza!
OK, it's a simple code:
proc tabulate data=have;
var age revenue;
tables
/*line*/
age
revenue,
/*column*/
(mean median);
run;
MK
it gives a vertical summary table like this :
| Age | Revenue | ||
| mean | median | mean | median |
PROC TABULATE
DATA=SASHELP.CLASS
;
VAR Height;
CLASS Sex / ORDER=UNFORMATTED MISSING;
CLASS Age / ORDER=UNFORMATTED MISSING;
TABLE
/* ROW Statement */
Sex *Age *(Height * Mean={LABEL="Average"} Height * Median={LABEL="Median"} ),
/* COLUMN statement */
ALL=' ' ;
;
RUN;
Based on your previous post, I edited the code because I have only numeric variables :
PROC TABULATE
DATA=SASHELP.CLASS
;
VAR Height Age;
TABLE
/* ROW Statement */
Height * Mean={LABEL="Mean"} Height={LABEL=""} * Median={LABEL="Median"}
Age * Mean={LABEL="Mean"} Age={LABEL=""} * Median={LABEL="Median"} ,
/* COLUMN statement */
ALL=' ' ;
;
RUN;
And I have the result that I want
:
| Height | Mean | 62.34 |
|---|---|---|
| Median | 62.80 | |
| Age | Mean | 13.32 |
| Median | 13.00 |
What I looked for is the " , ALL=' ' "
Thanks a lot @Reeza!
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 lock in 2025 pricing—just $495!
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.