Hello
I'd like to get some descriptive statistics and report them similar to the example below. For example we can take the data set cars. How should I list the individual parametes first and then the descriptives right after them in the same column? Proc report?
| - | x1 | x2 | x3 |
| - | 1 | 5 | 7 |
| - | 2 | 8 | 9 |
| - | 3 | 10 | 4 |
| - | 4 | 3 | 5 |
| N | 4 | 4 | 4 |
| mean | 2.5 | 6.5 | 6.25 |
| std. | 1.29 | 3.11 | 2.22 |
| min | 1 | 3 | 4 |
| median | 2.5 | 6.5 | 6 |
| max | 4 | 10 | 9 |
| %CV | 51.6 | 47.8 | 35.5 |
| geo. mean | 2.2 | 5.9 | 6.0 |
Thank you.
None of the standard procs will do that by default, you'll have to create your own data and then use proc print or report to display it.
Here's a sample, but it doesn't create the geomean.
data have;
input x1 x2 x3;
cards;
1 5 7
2 8 9
3 10 4
4 3 5
;
run;
proc means data=have stackods n mean min std median max cv;
var x1 x2 x3;
ods output summary=stats;
run;
proc transpose data=stats out=stats2;
id variable;
run;
data want;
set have (in=a) stats2(in=b);
if a then _NAME_='RAW';
drop _label_;
run;
None of the standard procs will do that by default, you'll have to create your own data and then use proc print or report to display it.
Here's a sample, but it doesn't create the geomean.
data have;
input x1 x2 x3;
cards;
1 5 7
2 8 9
3 10 4
4 3 5
;
run;
proc means data=have stackods n mean min std median max cv;
var x1 x2 x3;
ods output summary=stats;
run;
proc transpose data=stats out=stats2;
id variable;
run;
data want;
set have (in=a) stats2(in=b);
if a then _NAME_='RAW';
drop _label_;
run;
Thank you very much Reeza. Great solution!
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.