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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 555 views
  • 0 likes
  • 2 in conversation