BookmarkSubscribeRSS Feed
NPConcorida
Calcite | Level 5

How do I present in a table the mean and standard deviation of 34 variables X1-X34 ordered
from the highest to the lowest value of the mean?

1 REPLY 1
Reeza
Super User

https://gist.github.com/statgeek/d4c36ea88523d49e135a7aa494c29846

 

In this example, I sort by N, but hopefully you can see how to extend it to MEAN instead.

 

*generate fake data;
data have;
    array a(17);

    do i=1 to 100;

        do j=1 to 17;
            a(j)=rand('bernoulli', 0.27);

            if rand('bernoulli', 0.1)=1 then
                call missing(a(j));
        end;
        output;
    end;
run;

*Summary statistics;
proc means data=have stackods n sum mean maxdec=1;
    var a1-a17;
    ods output summary=want;
run;

*sort by N, descending count, and print;
proc sort data=want;
    by descending n;
run;

proc print data=want label noobs;
    label variable='Defect Categories';
run;

@NPConcorida wrote:

How do I present in a table the mean and standard deviation of 34 variables X1-X34 ordered
from the highest to the lowest value of the mean?


 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 911 views
  • 0 likes
  • 2 in conversation